Another alternative in 0.4 is to use Pair:

julia> z = Pair{Int32,Int32}[]
0-element Array{Pair{Int32,Int32},1}

julia> push!(z,Pair(Int32(1),Int32(2)))
1-element Array{Pair{Int32,Int32},1}:
 1=>2


On Tuesday, April 21, 2015 at 10:22:26 AM UTC-7, Kristoffer Carlsson wrote:
>
> In v0.3 you would use (Int32, Int32)[]
>
> In nightly it is Tuple{Int32, Int32}[]
>
>
> On Tuesday, April 21, 2015 at 7:12:01 PM UTC+2, Wai Yip Tung wrote:
>>
>> I have a newbie question. I have programming background in Python, Java, 
>> C. In some cases in Julia, like an empty array, I need to explicitly 
>> specify the type. I am rather confused about the syntax. There a a few 
>> plausible options like parenthesis, braces, colon. I have trouble to pick 
>> the right one. Right now I want to declare a one dimensional array of tuple 
>> of two integers. I tried this and it does not work.
>>
>>     (Tuple{Int32,Int32})[]
>>
>> I hope you can point me to use the syntax correctly
>>
>> Thanks,
>>
>> Wai Yip
>>
>>

Reply via email to