I am trying to make a simple multiplication tables program. I can get it to come up with one problem. After the student does the first problem, I want it to then go to the beginning and do another problem. Sort of like an old school “goto line 10” type deal and start over. Since I have a function, it won’t let me do a loop. This should be simple but I just cannot think of it. Here is a link to the program I have made up. Any help is greatly appreciated.
You could just copy the code from lines 9-15 and paste it after the playSound()
block on line 19, with it still being in the same if
block.
onEvent("submit", "click", function( ) {
theiranswer = getNumber("theiranswerbox");
if (theiranswer==correctanswer) {
playSound("sound://category_tap/vibrant_happy_tap_1.mp3", false);
problemnumber = problemnumber + 1;
firstnumber = randomNumber(1, 10);
secondnumber = randomNumber(1, 10);
correctanswer = firstnumber * secondnumber;
setText("label1", firstnumber);
setText("label2", secondnumber);
setText("problemnumberlabel", problemnumber);
} else {
playSound("sound://category_female_voiceover/you_lose_female.mp3", false);
}
});
1 Like
Thank you. I would have never though of that!