How can I go back to the beginning of my program first line by a command?

49 次查看(过去 30 天)
I would like to go back to the first line of my program after a yes no prompt input and go back to the beginning with the answer yes. I tried the return command in a If condition but it just directly ended my program. Thanks a ton!

回答(1 个)

Catalytic
Catalytic 2019-3-27
编辑:Catalytic 2019-3-27
keepGoing=true;
while keepGoing
answer=input('Do you wish to continue [yes/no]','s');
keepGoing=(answer=="yes");
end

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by