# Multiplication tables program/ looking for equivalent to old school "goto" command

**URL:** <https://forum.code.org/t/multiplication-tables-program-looking-for-equivalent-to-old-school-goto-command/37025>\
**Category:** Coding and Debugging Help\
**Created:** [October 5, 2022, 2:53pm UTC](https://forum.code.org/t/multiplication-tables-program-looking-for-equivalent-to-old-school-goto-command/37025 "2022-10-05T14:53:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ermiller](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@ermiller](https://forum.code.org/u/ermiller)\
**Post date:** [October 5, 2022, 2:53pm UTC](https://forum.code.org/t/multiplication-tables-program-looking-for-equivalent-to-old-school-goto-command/37025/1 "2022-10-05T14:53:57Z")

</div>

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.

> **[Check out what I made](https://studio.code.org/projects/applab/WjAE8jZxG5Zx23ta-0IAFWrw6cOxALzfemkxZdUaJsY)**
>
> I wrote the code myself with Code.org

---

<div class="post-metadata">

**Author:** ![wutadam](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/wutadam/32/7711_2.png) [@wutadam](https://forum.code.org/u/wutadam)\
**Post date:** [October 5, 2022, 2:57pm UTC](https://forum.code.org/t/multiplication-tables-program-looking-for-equivalent-to-old-school-goto-command/37025/2 "2022-10-05T14:57:51Z")

</div>

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.

```javascript
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);
  }
});

```

---

<div class="post-metadata">

**Author:** ![ermiller](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@ermiller](https://forum.code.org/u/ermiller)\
**Post date:** [October 5, 2022, 4:02pm UTC](https://forum.code.org/t/multiplication-tables-program-looking-for-equivalent-to-old-school-goto-command/37025/3 "2022-10-05T16:02:38Z")

</div>

Thank you. I would have never though of that!
