There is no need for a "then" key word. Use brackets for readability
if (x<0) x=-x end

I don't like the "then" keyword in IDL.
But I love it the python way:
if x<0: x = -x

So instead ask for removing the end keyword and using indentation.

The && option seems just like a work around for this propose and I do not 
find it more readable.
x<0 && x = -x  mixes conditions and execution statements.


Am Mittwoch, 19. März 2014 16:33:57 UTC+1 schrieb Cristóvão Duarte Sousa:
>
> Hi,
>
> Sometimes I see myself writing one line if-elses like `if x<0 x=-x end`, 
> which I think is not very "readable".
>
> What is your advice for that?
> "That is ok", "always put a semicolon after the condition" or "totally 
> avoid one liners"?
>
> BTW, have you Julia devs ever considered introducing a "then" keyword 
> which could optionally be placed after the condition (à la Ruby)?
> `if x<0 then x=-x end` seems much more readable.
>
> (I know the ternary operator, but I'm considering cases where no "else" 
> action exists.)
>
>

Reply via email to