Problem evaluating OR operator
Show older comments
I have what should be a simple problem, but after being stuck for a while, I dont know how to solve it.
Answer = '1';
if Answer == ('1') || ('2')
fprintf("inside if")
end
That works as it should, but when evaluating this case, it gives out an error which I don't understand why.
Answer = 'aa';
if Answer == ('1') || ('2')
fprintf("inside if")
else
fprintf("if didnt work")
end
I've checked out ANY and ALL functions, but dont seem to work for this. Im pretty sure this is a basic question but I'm stuck.
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!