Hi! First, since I’m new let me say I’ve been wanting to use julia for a some time and finally getting into it. Enjoying the language tremendously, thanks for all the great work.
There’s a way of writting long functions which I don’t see used, and I wonder why. Here it is:
foo(x, y, z) = begin r = 0 # ... compute stuff ... r end
instead of the standard
function foo(x, y, z) r = 0 # ... compute stuff ... r end
Are these equivalent? Almost all julia code I’ve seen uses the function keyword for long functions, or
foo(x, y, z) = (r = 0; ...; r) if it fits in one line.
I know it is stupid to fight a language’s syntax when you first start using it and I’ve got nothing against the function syntax, it does look better. The only thing going for the begin syntax is that the transition from short to long functions is more seamless, I think. Also, code written in this way has all the function names aligned to the first column which can be easier to scan.