Defining a Variable
This can be done by clicking the “Create variable” button. You can then define it by the name.
Setting a Variable
This can be done by using the set block. set [variable] = [value]
Text strings can also be stored in variables.
Changing a Variable
Variables can be changed using the change block. change [variable] by [value]
Using a Variable
Variables can be used in the place of numbers. There is one more thing you can do with variables, setting one variable to another.
This can be done by setting value
in the set block to a variable. set [variable] = [variable]
MATH section:
Number
This can be used as a simple block that can be defined as number n
.
2-Argument Operators
There are 5 operators that you can do in GKC with two operators:
- Add
- Subtract
- Multiply
- Divide
- Exponentation
Syntax:
[number/variable] [operator] [number/variable]
1-Argument Operators
There are many more operators that can be done with only one argument.
Symbol | Operator |
---|---|
square root | Takes the 2nd root of n |
absolute | Takes the absolute value of n |
- | -(n) |
Ln | Natural logarithm (e^ans=n) |
log10 | Standard logarithm (10^ans=n) |
e^ | Euler’s number |
10^ | Scientific notation number |
sin,cos,tan | Trigonometric functions |
asin,acos,atan | Inverse trigonometric functions |
Trig functions require another block
Numerical operators
Symbol | Operator |
---|---|
even | Check if n is divisible by 2 |
odd | Check if n is NOT divisible by 2 |
prime | Check if n is a prime number |
Whole | Check if n is a whole number |
Positive | Check if n is possible |
Negative | Check if n is negative |
divisible by | Check if n is divisible by x |
Note: divisible by
operator has two arguments.
Rounding
A number can be rounded to the nearest, or can be rounded up/down.
4.2 → 4 DOWN / 5 UP
Random Integer
This can be used to utilize randomization.
Argument:
randint([lower bound],[upper bound]