initialise Container from literal values?

Pixilang programming language
Post Reply
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

initialise Container from literal values?

Post by maks »

Not sure if I missed something, but is it correct that its not possible to initialise a Container from a set of literal values?
For example I wanted to do:

Code: Select all

myContainer =  [13, 19, 25, 31, 37, 43, 49];
or even better would be:

Code: Select all

my2DContainer = [
  [13, 19, 25, 31, 37, 43, 49],
  [0, 20, 26, 32, 38, 44, 50],
];
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: initialise Container from literal values?

Post by NightRadio »

You are right. This is not possible in the current version of Pixilang.
You should use this:

Code: Select all

c = new(4,1,INT)
c[0]=13
c[1]=19
c[2]=25
c[3]=31
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: initialise Container from literal values?

Post by maks »

No worries Alexander, thanks for letting me know. With containers being so central to Pixilang, I think this could be a good future feature.

Btw I asked because I'm currently porting some midi code across to Pixilang and have a 2d array that I need to use https://github.com/maks/dart_fire_midi/ ... e.dart#L14 which I'll need to re-enter one element/line for pixilang
Post Reply