필터 지우기
필터 지우기

respond equal a character ?

조회 수: 3 (최근 30일)
Ugur Sahin
Ugur Sahin 2020년 5월 3일
편집: Stephen23 2020년 5월 4일
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.
  댓글 수: 1
Ugur Sahin
Ugur Sahin 2020년 5월 4일
thank you so much :)

댓글을 달려면 로그인하십시오.

추가 답변 (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