![]() |
This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (August 2018) |
This Ruby tutorial talks about operators, such as +, -, /, *, etc.
Math Operators
Here is a list of the math operators in Ruby, and what they are in Scratch.
Ruby | Scratch Version |
---|---|
x + y |
(x) + (y)
|
x - y |
(x) - (y)
|
x / y |
(x) / (y)
|
x * y |
(x) * (y)
|
Exponents
In Ruby, numbers can be raised to any power easily, using x ** y
In Scratch, this is a little more complicated (see Solving Exponents)
Operators Such as And, Or, Etc.
x > y || y > x
- Is x greater than y or y greater than x? If either of them are, x > y || y > x equals
true
. If neither of them are, returnsfalse
. - In Scratch:
<(x) > (y)> or <(y) > (x)>
- Is x greater than y or y greater than x? If either of them are, x > y || y > x equals