Looping prompt till answered correctly

1 次查看(过去 30 天)
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