respond equal a character ?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Ugur Sahin
il 3 Mag 2020
Modificato: Stephen23
il 4 Mag 2020
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 Commento
Risposta accettata
Walter Roberson
il 3 Mag 2020
Use strcmp() or strcmpi() or ismember()
Using ~= together with "||" will fail if the user enters more than one character.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!