January 21, 2017

Test Tiles and Boolean Logic

Number Comparisons ImageRather than an if..then type construction, Etoys has a "test" tile found in the tests viewer category and in the Script Editor gold box. I am ok with this because it does have clarity. Is this true?..yes or no. Drag a variable or property name tile (not the assignment symbol) onto the test section of the tile. Cycle the up/down arrows or left click to select available comparison operators.  Most types except number and boolean can only be compared for equality.  The comparison value
Boolean Type Imagedisplay box will accept variables and property names for all types and expressions for number types. Compared values must match type. Drag statement tiles into the yes and/or no branches that will run depending on the result of the comparison.









Logical And ImageThere are no boolean operators logical AND, logical OR or logical NOT. Logical constructs are built using nested "test" tiles.











Logical OR Image

















Switch statements are just a matter of piling "test" tiles on top of each other with a default action stuck in the No branch of the last "test" tile. If you wish to use Boolean operators you can convert the script to text using the Script Editor menu options and type them in.  The Terse Guide to Squeak is very helpful.





Last Updated.