Lists question

Banana Lord

Member
I'm sure it's obvious, but why does this not work?
PHP:
int one = 1;
int two = 2;

foreach number in $ints[one, two]
	print(number);
 

bumcheekcity

Active member
Because $int[one] is not a number. The entries inside the square brackets are not variables. Which is why this works.

Code:
foreach a in $strings[hello, world] 
    print(a);

"hello" and "world" are not variables. They are interpreted literally.
 
Top