Below are several blocks that use if
and if-else
. Predict what each one will do and discuss it with your
neighbor. Once you've done so, you try running each of the blocks, which can be found here.
You'll notice that a couple of the scripts below use the block. This block actually allows you to use many different mathematical functions. It shows
up in the palette as . Just
click the drop-down menu to select which function to use. "abs" is short for "absolute value." In case
you're not already familiar, the absolute value of a number is just that number turned positive. For
example, abs(10)
is just 10
, while abs(-2.5)
is 2.5
.