Logical Commands

AND
IF
NOT
OR


AND

if val­ues are num­bers: returns 1 if both val­ues are not zero, oth­er­wise returns 0. If using text then it is assumed that you are refer­ring to labels and the return result will be instances from the time­line that con­tain both labels. AND” is com­mon­ly used inside oth­er com­mands (see IF, COUNT…) and can be com­bined with OR” and NOT

Format: labels AND labels OR num­ber AND number

Arguments: labels: quot­ed text rep­re­sent­ing labels in the time­line num­ber: numer­i­cal expression

Available: Available for all win­dows Version: 9 and later

Example: 

In this exam­ple: $a=“block” and spike” 

show count $a 
Shows the num­ber of instances with labels block” and spike” in them

show count not (“a” or b” and c”)
Counts the num­ber of instances that do not have a” or have b” and c” as labels in them. AND will be cal­cu­lat­ed first before the OR as it has high­er pri­or­i­ty. Use brack­ets to force logic.


IF

Executes the state­ment based on a condition

Format: IF (con­di­tion, true state­ment, false state­ment) OR IF (condition,true statement)

Arguments: con­di­tion: if this numer­ic val­ue is 0 it is con­sid­ered false and will exe­cute the false state­ment oth­er­wise any nonze­ro result is con­sid­ered true and will exe­cute the true state­ment. You can use any rela­tion­al oper­a­tors =,=,!= on num­bers or quot­ed text and log­i­cal oper­a­tors AND, OR, NOT on num­bers. When an emp­ty string is com­pared to a num­ber with = or !=, the string will be cons­diered as 0. state­ment: any nor­mal com­mand includ­ing anoth­er IF

Available: Available for all win­dows Version: 9 and later

Example: 

if (5 shows true. You can change the result by chang­ing the con­di­tion to 6 

In this exam­ple: $a=cell(1,0)  

if ($a
Shows whether cell in col­umn 1, row 0 is pos­i­tive or neg­a­tive number 

if ($a!=0, show 5/$a, show N/A”) 
Shows 5 divid­ed by the con­tents of cell in col­umn 1, row 0. If that cell is 0 or blank then show N/A”

if (“tom” < tot” and 4 shows true if (“tom” < tot” and 6
Will do noth­ing as the con­di­tion is false and there is no false statement


NOT

if val­ue is num­ber: returns 1 if val­ue is 0, oth­er­wise returns 0. If using text then it is assumed that you are refer­ring to labels and the return result will be instances from the time­line that do not con­tain the label. NOT” is com­mon­ly used inside oth­er com­mands (see IF, COUNT…) and can be com­bined with AND” and OR

Format: NOT labels OR NOT number

Arguments: labels: quot­ed text rep­re­sent­ing instances labels in the time­line num­ber: numer­i­cal expression

Available: Available for all win­dows Version: 9 and later

Example:

In this exam­ple: $a=not spike”

show count $a
Shows the num­ber of instances which do not have spike” in them

show count not (“a” or b” and c”)
Counts the num­ber of instances that do not have a” or have b” and c” as labels in them. AND will be cal­cu­lat­ed first before the OR as it has high­er pri­or­i­ty. Use brack­ets to force logic.


OR

if val­ues are num­bers: returns 1 if either val­ue is not zero, oth­er­wise returns 0. If using text then it is assumed that you are refer­ring to labels and the return result will be instances from the time­line that con­tain either label. OR” is com­mon­ly used inside oth­er com­mands (see IF, COUNT…) and can be com­bined with AND” and NOT

Format: labels OR labels OR num­ber OR number

Arguments: labels: quot­ed text rep­re­sent­ing labels in the time­line num­ber: numer­i­cal expression

Available: Available for all win­dows Version: 9 and later

Example

In this exam­ple: $a=“block” or spike”

show count $a
Shows the num­ber of instances with either block” or spike” in them

show count not (“a” or b” and c”)
Counts the num­ber of instances that do not have a” or have b” and c” as labels in them. AND will be calu­lat­ed first before the OR as it has high­er pri­or­i­ty. Use brack­ets to force logic.