respond equal a character ?
1 view (last 30 days)
Show older comments
hi all,
I did it,
accept=input('do you want to play again, Yes(Y,y), No(N,n); \n','s');
while accept~='Y'||accept~='y'||accept~='N'||accept~='n'
accept=input('do you want to play again, Yes(Y,y), No(N,n); \n','s');
end
and it is not working. I couldn't save quastion of while loop can anyone help me ?
1 Comment
Accepted Answer
Walter Roberson
on 3 May 2020
Use strcmp() or strcmpi() or ismember()
Using ~= together with "||" will fail if the user enters more than one character.
More Answers (0)
See Also
Categories
Find more on Whos 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!