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

49 Ansichten (letzte 30 Tage)
Thomas Lu
Thomas Lu am 27 Mär. 2019
Bearbeitet: Catalytic am 27 Mär. 2019
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!

Antworten (1)

Catalytic
Catalytic am 27 Mär. 2019
Bearbeitet: Catalytic am 27 Mär. 2019
keepGoing=true;
while keepGoing
answer=input('Do you wish to continue [yes/no]','s');
keepGoing=(answer=="yes");
end

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by