Julia is sensitive to whitespace.

Unlike python, it is not sensitive to the amount of leading whitespace.


On Friday, July 25, 2014, John Myles White <[email protected]> wrote:

> This is an interesting case. You need semicolons to get this to work on a
> single line:
>
> function bounds(p::Vector); [min(p), max(p)]; end
>
> The preferred way to do this, by the way, is with the one-liner special
> syntax:
>
> bounds(p::Vector) = [min(p), max(p)]
>
>  -- John
>
> On Jul 25, 2014, at 11:21 AM, Zenna Tavares <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
> AFAIK whitespace is supposed to be insignificant in non-macro Julia.
>
> Yet,
>
> function bounds(p::Vector) [min(p), max(p)] end
>
>
>
>
> fails with
>
> ERROR: syntax: expected "(" in "function" definition
>
> whereas
>
> function bounds(p::Vector)
>   [min(p), max(p)]
> end
>
>
>
> does not.
>
> Is this a bug?
>
>
>

Reply via email to