respond equal a character ?

3 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2020-5-4
编辑:Stephen23 2020-5-4
Given A~=B, can you give a value of X which will make this statement false?:
X~=A || X~=B

请先登录,再进行评论。

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by