$p[0] - The Number of Possibilities

Top  Previous  Next

References to parameter values begin with 1 so the first value in a parameter is referenced by $p[1]

 

For example.

 

$p=list("red","orange","yellow","green","blue","indigo","violet")

 

$p[1] = red

$p[2] = orange

...

$p[7] = violet

 

$p[0] is given a special value - the number of possible values in the parameter.

 

In the above example, this means that $p[0] = 7

 

Note: you can also use the count command to count the number of possible values in a parameter.  {count($p)} = 7