Problem evaluating OR operator
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!