Filter löschen
Filter löschen

respond equal a character ?

3 Ansichten (letzte 30 Tage)
Ugur Sahin
Ugur Sahin am 3 Mai 2020
Bearbeitet: Stephen23 am 4 Mai 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 Kommentar
Stephen23
Stephen23 am 4 Mai 2020
Bearbeitet: Stephen23 am 4 Mai 2020
Given A~=B, can you give a value of X which will make this statement false?:
X~=A || X~=B

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 3 Mai 2020
Use strcmp() or strcmpi() or ismember()
Using ~= together with "||" will fail if the user enters more than one character.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by