Help with a simple if statement

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help with a simple if statement

takem
I am writing a script that asks the user a Yes/No question. If the user selects "Yes", the script will run through a if statement, otherwise, it will skip the if statement:

choices = newArray("Yes", "No");
Dialog.create("Select choice");
Dialog.addMessage("Are there any areas that need to be removed?");
Dialog.addChoice("-->", choices);
Dialog.show();
choice = Dialog.getChoice();
 
if  (choice == "Yes") {
title = "Removal";
msg = "After selecting area to be removed with the brush tool, click \"OK\".";
waitForUser(title, msg);

roiManager("add");

Dialog.create("Select choice");
Dialog.addMessage("Are there any more areas that need to be removed?");
Dialog.addChoice("-->", choices);
Dialog.show();
choice = Dialog.getChoice();
}

If at the end of the if statement, the user selects "Yes" again, I want it to run through the if statement one more time. However, my script continues no matter what the user chooses. How can I loop it back to the if statement?