How can I use "OR" in this situation? I want it to show if x==2 or d~=0

3 views (last 30 days)
if x==2
disp('Given value is a prime!')
elseif d~=0
disp('Given value is a prime!')
end

Accepted Answer

jean claude
jean claude on 5 Oct 2017
Edited: jean claude on 5 Oct 2017
if x==2 || d~=0
disp('Given value is a prime!')
end

More Answers (0)

Categories

Find more on Discrete Math in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!