Exit at method/function level?

Monkey Forums/Monkey Programming/Exit at method/function level?

Nobuyuki(Posted 2012) [#1]
I'm not sure where to make this request, but can we possibly get this feature in Monkey? Using an If block to encapsulate code rather than having Exit at that scope is all fine and good as a workaround, but for people who nest a lot of these conditions, it makes code start to look harder to read. It would be a lot more convenient to have a one-line Exit Method / Exit Function / Exit at that level; no creating a new tab block for the code inside, no sequential lines of "End" to deal with.

Is it considered bad form to use Exit-like syntax to end a function or method block early? Are there technical limitations/considerations? I don't actually know, but I'd like to. Mark, pretty-please consider this little bit of syntactic sugar, if there wouldn't be problems implementing it? (·w·`)



EDIT: Wow, I'm a dummy. I guess Return would work for this purpose, wouldn't it? Guess I've been doing Basic too long -- "Exit Sub" is ingrained in my brain for anything that's not a Function, and I assumed Return wouldn't work if a function/method returns Void...


Shinkiro1(Posted 2012) [#2]
Yes, Return does what you want ;)