Well, there is zero(..) but that is defined only for numeric types

julia> zero(Int64)
0

julia> zero(ASCIIString)
ERROR: no method convert(Type{ASCIIString}, Int64)
 in zero at operators.jl:146

julia> zero(Float64)
0.0

On Thursday, 27 February 2014 06:25:39 UTC, Fil Mackay wrote:
>
> Is there an easy way, given a particular intrinsic Type, to create a 
> default (zero) instance? eg.
>
> z(Int64)
> # 0::Int64
>
> z(ASCIIString)
> # ""::ASCIIString
>
> Akin to the C# default 
> keyword<http://msdn.microsoft.com/en-us/library/xwth0h0d.aspx>, 
> that returns the default initialised value of any type.
>
>

Reply via email to