Xojo Parameter Brackets

Seems like brackets are optional? What’s the rule here?

System.DebugLog "Hi Mom!"

works as well as

System.DebugLog("Hi Mom!")

If the method returns a value (a function) any parameters passed need to be enclosed in parentheses.

If It is a just a method (no return value) they are optional

-karen

Thanks, @Karen.
I wonder where that policy came from? I’ve not noticed other languages that work that way…

I would guess because when you return a value that value not only has to be used (assigned to something) but the return value could be combined with other values before assignment.

Eg

Y = someFunction( x + a + b ) + c

Y = someFunction x + a + b + c

Sorry, I probably wasn’t being clear. What I meant was, are there any other languages where brackets for parameters are optional? I’ve not encountered that before, and only noticed it when looking at others (usually older) Xojo/RB code.

You’d have to ask Andrew Barry - the original design of Cross Basic which has evolved into Xojo
This has been the case forever

I dont know of one