ID:163958
 
If I have a list with 1 or more objects in it how do I determine how many objects are in it?
The length of a list is stored in the list.len variable.


-TKL
In response to Kangchao

if(list.len) //<-- I know this asks if the list has any length


But how do I ask if the list has a length of 2 or 3?
In response to Tranovan
..bump..
In response to Tranovan
if(list.len=2||3)


Maybe this, I'm not too sure.
In response to Tranovan
Just as he said: The list's length is stored in the 'len' variable. As such, it will be equal to how many items are in the list:


var/list/myList1=list("one","two","three")
// myList1.len would be 3

var/list/myList2=list("one","two","three","four","five")
// myList2.len would be 5

In response to DarkD3vil666
DarkD3vil666 wrote:
> if(list.len=2||3)
>

Maybe this, I'm not too sure.

Almost. You need to be using the == operator here. Also, you must give another statement to be evaluated after the || operator.

if(myList.len==2 || myList.len==3)
// Stuff here.