Initialize array

0

I have a question and I do not know how to resolve it.

I have this array created:

var data: [(x: Double, y: Double)]

Trying to use it tells me it is not initialized.

You can tell me how to initialize it, I can not do it.

Thanks for the help.

    
asked by Shadros 18.09.2018 в 09:02
source

1 answer

2

The easiest thing is to initialize it empty in the same statement

var data: [(x: Double, y: Double)] = []

or if you want to give values, for example

var data: [(x: Double, y: Double)] = [(2.4, 3.5), (0.4, 5.5)]
    
answered by 18.09.2018 / 09:24
source