8. Operators

In general, operator code blocks process inputs (they do something with the inputs) and returns an output.

8.1. Math

Math operators do the typical math things.

_images/00-math-add.png

This code block adds two numbers.

_images/01-math-subtract.png

This code block subtracts two numbers.

_images/02-math-multiplication.png

This code block multiplies two numbers.

_images/03-math-division.png

This code block divides two numbers.

_images/15-mod.png

This code block returns the remainder of two numbers.

_images/16-round.png

This code block rounds a number.

_images/17-abs-of.png

This code block returns the absolute value of a number.

Code

8.2. Random numbers

You may also generate random numbers.

_images/04-pick-random-1-to-10.png

This code block is used to generate random numbers.

Code

8.3. Comparison

Comparison code blocks returns either True or False.

_images/05-compare-greater-than.png

This code block compares if the left value is greater than the right value.

_images/06-compare-less-than.png

This code block compares if the left value is less than the right value.

_images/07-compare-equality.png

This code block compares if the left and right values are equal.

Code

8.4. Boolean operators

You may chain together multiple comparisons.

_images/08-boolean-and.png

This code block returns True if both comparisons are True.

_images/09-boolean-or.png

This code block returns True if one of the comparisons is True.

_images/10-boolean-not.png

This code block returns True if the comparison is False.

Code

8.5. String operations

These are code blocks that may be used to manipulate string values.

_images/11-join.png

This code block joins (or concatenates) two strings.

_images/12-letter-1-of-apple.png

This code block returns the letter at the specified index from the string.

_images/13-length-of-apple.png

This code block returns the length of the string.

_images/14-contains.png

This code block checks to see if the string contains the specified value (or substring).

Code