Loops: For…End is Allowed?

About Monkey 2 Forums Monkey 2 Development Loops: For…End is Allowed?

This topic contains 7 replies, has 7 voices, and was last updated by  cocon 1 year, 2 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13216

    Diffrenzy
    Keymaster

    I just realized that I can substitute “Next” with “End” in “For… loops.

    Has this always been the case for Monkey 2, and is it expected  behaviour?

     

    #13217

    DruggedBunny
    Participant

    Yes, that was the case in Monkey1 as well — most blocks can use End, eg. While certainly works.

    #13218

    Diffrenzy
    Keymaster

    Well what do you know!  I Only started using just “End” in my current project, so I stumbled upon this by accident.

    Thanks!

    #13223

    nerobot
    Participant

    Next and Wend are more readable for me.

    #13226

    abakobo
    Participant

    In complex loops I’m even writing the var letter for the Next

    For i
    For j

    Next ‘j
    Next ‘i

    and must say I miss the fact that the compiler refuses to compile without the comment token “‘”

    #13229

    Hezkore
    Participant

    Oh wow I had no idea..
    I’ll probably stick with Next and Wend, for readability (like nero said) but good to know!

    #13244

    therevills
    Participant

    Since I’m a Java developer I like the option of using “End” as in Java you just use braces { }:

    Java:

    Monkey2:

    Java:

    Monkey2:

    #13255

    cocon
    Participant

    Interesting, 🙂 I did not know about it, switching to it.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.