$p[] - All the Possibilities

Top  Previous  Next

Sometimes you will want to create a reference range that references ALL the values the parameter can take. All references start with 1, but to create your reference range you need to know how many possibilities the parameter can produce. There are a number of ways of doing this.

 

For example, if you create the following parameter.

 

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

 

To list all of the values we would write:

 

$p[1,7]        which will produce "red, orange, yellow, green, blue, indigo, violet"

 

but only because we know that there are 7 entries in our list.

 

Alternatively, we could write

 

$p[1,$p[0]]        which will produce the same list because $p[0] contains the number of possibilities (7)

 

but this is a lot to remember and write.

 

The final option is to create an empty reference.

 

$p[]

 

If you include no references, the full list will be automatically output.