The Basic Format Of An If Command

Top  Previous  Next

The If command has the following format


if(condition to be satisfied, value if true, value if false)


For example, an if statement might look like this




When this command is run, the inline calculator will look at the value of the $n parameter. If the value is greater than 0, this statement will be replaced by 100. If the value is less than or equal to 0, the statement will be replaced by -20.


If commands will often include multiple parameters.




With this command the inline calculator will return the value of either $p or $q, depending on the value of $n.