Surprising it may be, but also sensible. An assignment always returns the 
assigned value, not the variable it is assigned to:

let
    x::Float64 = 5
    x
end::Float64

I think there's something in the docs that describes that behaviour, but I 
can't seem to find it right now...

Am Dienstag, 21. Juli 2015 06:03:03 UTC+2 schrieb Ismael VC:
>
> This was surprising:
>
> julia> versioninfo()
> Julia Version 0.4.0-dev+5491
> Commit cb77503 (2015-06-21 09:45 UTC)
> Platform Info:
>   System: Linux (x86_64-unknown-linux-gnu)
>   CPU: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
>   WORD_SIZE: 64
>   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
>   LAPACK: libopenblas
>   LIBM: libopenlibm
>   LLVM: libLLVM-3.3
>
> julia> let
>        x::Float64 = 5
>        end::Float64
> ERROR: TypeError: typeassert: expected Float64, got Int64
>
> julia> let
>        x::UTF8String = "test"
>        end::UTF8String
> ERROR: TypeError: typeassert: expected UTF8String, got ASCIIString
>
>
>

Reply via email to