ScratchData LogoScratchData
Back to _paperN1's profile

SpeedTest: Returning Values According to Booleans

_P_paperN1•Created July 24, 2015
SpeedTest: Returning Values According to Booleans
0
0
9 views
View on Scratch

Instructions

Click on each sprite to show the time. Sometimes, you make a custom block that returns 0 if a statement if false and 1 if the statement if true. The conventional way is this: if (bool) { return 1; } else { return 0; } But in Scratch you can do this: return 0+(bool); Which means a shorter script. However, it turns out to be a little slower, because the second script needs to add a number with the Boolean, and it also needs to check if the boolean is true, where the other function only check the value of the boolean, then returns a value it does not have to compute using arithmetic.

Description

To @TheLogFather for idea.

Project Details

Project ID71357472
CreatedJuly 24, 2015
Last ModifiedJuly 24, 2015
SharedJuly 24, 2015
Visibilityvisible
CommentsAllowed