Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Assigning values to defined Tuple-array

$
0
0

@Jonas_Hjulstad wrote:

I am trying to create a tuple-array without assigning values to the tuples. Declaring tuples as an array runs smoothly:

tuples = Array{Tuple{Int, Int},2}
tuples[1] = (1,2)

However, trying to index any elements gives a “no matching setindex”-error. What happens when i declare tuples as an array, and why is it different than directly assigning values upon initialization?

Example, this runs fine:

tuples = [(1,2),(3,2)]
tuples[2]

Posts: 7

Participants: 5

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles