Looping prompt till answered correctly

조회 수: 2 (최근 30일)
Kalpha.mc
Kalpha.mc 2020년 9월 12일
답변: Walter Roberson 2020년 9월 12일
I need to set a limit so the number that is inputed can not be 9 or under. with a loop that will display the prompt again if you don't answer correctly. If the number is 10 or over it will let you continue.

답변 (1개)

Walter Roberson
Walter Roberson 2020년 9월 12일
while true
prompt for input
if the input was numeric and the input was scalar and the input is not complex valued and the input is in range
break
end
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by