respond equal a character ?
조회 수: 1 (최근 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
채택된 답변
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 Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!