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

55 views (last 30 days)
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!

Answers (1)

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

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!