Semicolon

Monkey Forums/Monkey Programming/Semicolon

teremochek(Posted 2011) [#1]
In "BlitzMax" is Semicolon that allows you to write two "IF" on one line. There is, whether something similar realties in Monkey ?
if a>0 ; if a=2 then a=0
' or just
a=10 ; b=12 ; c=23



Volker(Posted 2011) [#2]
Simply use spaces:
local a=10  local b=12 local c=23



ziggy(Posted 2011) [#3]
What about:
If a>0 And a=2 then a = 0


Simply use spaces
AFAIK this works becouse of the way the internal Monkey tokenizer and parser works, but this is not officially supported. Officially, if I'm not wrong, several sentences in the same line is not allowed in Monkey. So while it works sometimes, this could change in the future.


AdamRedwoods(Posted 2011) [#4]
Semicolons helped with readability, especially when writing for 99 line ray-tracing competitions.


luggage(Posted 2011) [#5]
I wouldn't mind if it just ignored the semi colon, coming from a C/C++ background it's second nature to end a line with a ; now.


Neuro(Posted 2012) [#6]
I kinda wish we had this. I unconsciously put a semicolon after each line. Now trying to train myself not to do this when coding in monkey :).


ziggy(Posted 2012) [#7]
mmm, why? Semicolons where added several Monkey versions ago, they're just optional now.
Function Main();
	Local a:String = "Hello World!";Print(a);
End



Neuro(Posted 2012) [#8]
Lol, goes to show you how behind i am. Thanks ziggy, I feel much better now :).