Now you’ve come to the fun part of programming – operators!
Operators are things like:
Operator | Example |
Addition | 3 + 2 |
Subtraction | 3 – 2 |
Multiplication | 3 * 2 |
Division | 6 / 3 |
Exponentiation | 4 ^ 2 |
Now you remember when you were a kid, your mom or dad might have asked you:
What is 4 times 3?
Let’s see what Vaklipi would say if it was asked such a question.
com.aiaioo.VaklipiOutputFixture | ||
program | run() | |
What is 4 times 3? | 12.0 |
fit.Summary |
It knows its math, yeah? We can ask it other things like:
What is 10 plus 2 divided by 3?
Here below is a set of examples in English:
com.aiaioo.VaklipiOutputFixture | ||
program | run() | |
What is 10 plus 2 divided by 3? | 4.0 | |
What is 10 into 2 divided by 4? | 5.0 | |
What is 10 plus 2 plus 4? | 16.0 | |
What is 10 plus 2 minus 4? | 8.0 |
fit.Summary |
Oh! It looks like there was a mistake on the first line!
10 plus 2 divided by 3 is treated as 10 plus (2 divided by 3), and not as (10 plus 2) divvied by 3.
Why so? Well, there is a convention in math called BODMAS.
This convention puts division before addition. That’s all.
Learn more about BODMAS here: http://www.mathsisfun.com/operation-order-bodmas.html
Now, if you were talking Hindi, you would say something like:
३ गुणा २ (3 times 2)
com.aiaioo.VaklipiOutputFixture | ||
program | run() | |
३ गुणा २ छापो. | 6.0 |
fit.Summary |
Learn
You can learn programming with Vaklipi in the following pages:
- Introduction: Learn about Vaklipi
- Output: Learn to write out messages in Vaklipi
- Declarations: Learn to set the value of a variable
- Operators: Learn to do addition, multiplication, division etc.
- Conditionals: Learn to take specify the conditions for performing certain steps.
- Looping: Learn to repeat steps till some condition is satisfied.
- Jumping: Learn to jump to some point in the code.
- Functions: Learn to issue an command.
- Constructors: Learn to create an object of a certain type.
- Selectors: Learn to refer to a real world object.