Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0

Problem with repeat and until


1 answer to this question

Recommended Posts

  • 0

It's hard to find the error because indentation is a mess, to be honest. I strongly recommend that you learn how to indent the code properly. If you do that, you should get something like https://pastebin.com/D5adZ0HV. Look at the line 97: you can easily notice that the position of elseif seems weird. Backtrack a little to find where it went wrong — and there, the line 44 contains an extraneous end.

Now, if you remove it and re-indent the code again, you'll find out that the last line seems out of place. Sure enough, if you just remove that end, there will be no other end to close the if! So you should add end before that last line.

After all of that, the original problem will be solved. I'll note that the code uses global variables throughout; it has sections like L59–87 which could be replaced by a for loop (and which could take 4 lines of code instead of 29); event.listen is called incorrectly (the anonymous function should be the second argument of the call but is instead discarded); the repeat loop with a dubious exit condition can be replaced with a more relatable while true do loop. All of those are either present problems or potential issues that can manifest themselves when you least expect them to, and worth fixing.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.