Conditionals

Previous  Terms  Next

TinkerPlots_logoV2-rgb


Conditionals

if

Creates an "if" block. If the expression in parentheses after if is true, the formula returns the upper value; if not, it returns the lower. The example below returns "big" if the value for xx is greater than 2 and "small" otherwise.

TinkerPlotsHelp-1-112-001

switch

Acts like a sophisticated if, and is very useful for recoding attributes. It takes an optional expression inside parentheses and then evaluates each of any number of true/false expressions to determine which value to return. This is best shown with a couple of examples.

TinkerPlots interprets the following expression by substituting age for ? in each of the expressions, starting at the top, until it finds one that is true. It returns the value to the right of the colon for that expression. So, if age is 45, the value of the entire expression is "mature."

TinkerPlotsHelp-1-112-002

Here's another example, one that might be used to recode numeric data into meaningful phrases. TinkerPlots compares the value of eduCode with each of the numbers in parentheses and returns the expression to the right of the first one that matches. If none match, it returns the value of the expression to the right of else.

TinkerPlotsHelp-1-112-003

 


TinkerPlots Help

© 2012 Clifford Konold and Craig D. Miller