What is the equivilent of a python list in pixilang?

Pixilang programming language
Post Reply
philipbergwerf
Posts: 132
Joined: Sat Mar 17, 2018 4:23 pm

What is the equivilent of a python list in pixilang?

Post by philipbergwerf »

What is the equivilent of a python list in pixilang?
A python list looks like this:

Code: Select all

mylist = [1, 2, 3, 4]
and you can access the items like so:

Code: Select all

firstitem = mylist[0]
seconditem = mylist[1]
etc = mylist[2]
Is there something similar in pixilang?
User avatar
NightRadio
Site Admin
Posts: 3549
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: What is the equivilent of a python list in pixilang?

Post by NightRadio »

There is no direct alternative.
But you can use the arrays:

Code: Select all

mylist = new( 4, 1, INT )
mylist[ 0 ] = 1
mylist[ 1 ] = 2
mylist[ 2 ] = 3
mylist[ 3 ] = 4
firstitem = mylist[ 0 ]
seconditem = mylist[ 1 ]
philipbergwerf
Posts: 132
Joined: Sat Mar 17, 2018 4:23 pm

Re: What is the equivilent of a python list in pixilang?

Post by philipbergwerf »

Thank you for the clear example!
Post Reply