|
Using conditionals |
Top Previous Next |
|
One may also operate over part of a set depending upon a conditional. For example the following statement
Z=sum(thisI$nzz(thisI),1);
would add up the number of elements in thisI that are associated with a nonzero value of nzz(thisI) as controlled by the conditional $nzz(thisI). The chapter on conditionals covers a lot more cases and provides a fuller description. Some particular forms of conditionals merit special mention in this document on sets. Conditionals can involve functions that return particular values depending on the position of elements in sets, the length of sets or the comparison of set elements to each other or text strings. These functions are defined in the section on functions below. Discussion of their use follows. |