Spotlight: The Operators
If you do not already have Scratch or need extra help, please
use the support page
The operators manipulate data.
You will notice that the blocks have different shapes. Subsequently, some fit together into some
blocks but not others. Test it out and
find out which blocks fit together
The first four perform basic maths operations: add, subtract,
multiply and divide where divide will give a decimal (the numbers entered in
are floating point such as 6.0).
Remember the order
of operations matters; furthermore, the rounded blocks will act as parentheses,
so anything to be calculated first is anything in parenthesis.
Example:
(2+3+4) x5 = 45
2+3+ 4 x5 = 25
The next block will pick a random number between any two
numbers that you enter.
The inequality and equals signs
> Greater than, for example 45 > 20
= Equal, for example 3 = 3
The Boolean operators (named after George Boole)

Boolean operators have two values true or false
And both must be true.
Or Either one or both must be true.
Not this gives a false answer when true.
Truth table
Join, letter_of _ and length_of_
Join
Join is another word for concatenation (this term is used a lot in programming). The block will join things
together.
For example
Letter_of_
This will pick out that letter in the sequence, so if you
want to pick out n in concatenation you would use Letter 3 of concatenation.
Length of_
A string is a sequence of characters. This block will find the number of characters of the string
and output that value.
Mod
Mod and Round
Mod
This handy little operator will return the remainder of
division. If you enter 8 mod 2 the
return is 0 because there is no remainder. On the other hand, if you enter 7
mod 2 the return is 1.
Round
This will round decimals to the nearest integer. Integers are whole numbers like 1, 45 and 134.
However, numbers like 5.5 or 2/3 are
not.
Example, if you enter 3.45, the return will be 3 or if
you enter 5.5, the return will be 6
_of_
This computes a function.
You can use the drop down menu by clicking on the black arrow and choose
from a list
The options are:
abs = absolute value
sqrt = square root
sin = sine
cos = cosine
tan = tangent
asin = arcsine (inverse of sine or sin^-1)
acos = arccosine (inverse of cosine or sin^-1)
atan = arctan (inverse or tan^-1)
ln = Natural log
log = logarithm
e^ = Euler's number to the power of something
10^ = 10 to the power of something
Note: The online version has two extra
floor = no number lower than
Ceiling = no number higher than
Happy coding :-)
Next Spotlight: The control blocks
This computes a function.
You can use the drop down menu by clicking on the black arrow, then choose
from a list
abs = absolute value
sqrt = square root
sin = sine
cos = cosine
tan = tangent
asin = arcsine (inverse of sine or sin^-1)
acos = arccosine (inverse of cosine or sin^-1)
atan = arctan (inverse or tan^-1)
ln = Natural log
log = logarithm
e^ = Euler's number to the power of something
10^ = 10 to the power of something
Note: The online version has two extra
floor = no number lower than
Ceiling = no number higher than
Key points
- The operator blocks manipulate numbers
- Count characters in a string - this could be letters, numbers or even symbols
- Can pick out a letter, value or symbol in a string.
Happy coding :-)
Next Spotlight: The control blocks
Comments
Post a Comment