ScratchData LogoScratchData
Back to TheLogFather's profile

Boolean Behaviour in Scratch -quick demo

THTheLogFather•Created May 5, 2016
Boolean Behaviour in Scratch -quick demo
71
41
979 views
View on Scratch

Description

Just a little demo that Scratch really does consider boolean values true & false to be equivalent, numerically, to values 1 and 0. Now, the interesting part is that boolean true and false are also considered equal to text strings "true" and "false", BUT text "true" and "false" are NOT equivalent to one and zero. So we have the paradoxical: 1 = true = "true", but 1 ≠ "true" That means you have to get boolean true value from a REAL boolean expression, not typed as text string "true", if you want it to behave as numerical value 1 in a mathematical expression. However, since ANY non-numerical text string is treated as value zero in a mathematical expression, text string "false" will work fine for zero – but so will "true"!! Also, note that phosphorus behaves in a different way: http://phosphorus.github.io/#108360618

Project Details

Project ID108360618
CreatedMay 5, 2016
Last ModifiedMay 6, 2016
SharedMay 6, 2016
Visibilityvisible
CommentsAllowed