If you’re a beginner to programming, start at one of the following:
- Introduction: Learn about Vaklipi
- Output: Learn to write out messages in Vaklipi
So far, we haven’t really had to deal with logic, have we?
Logic is about evaluating the truth and falsehood of a statement.
In programming, it is important to do some things based on whether or not certain conditions hold (that is, evaluate to true).
A good example is describing the price of a book. If the price is greater than 200 rupees, you might want to say “expensive” and otherwise you might want to say “not expensive”. In Vaklipi, let’s say the book’s price is referred to by the variable p, you can say the following:
If p is greater than 200, say “expensive” else say “not expensive”.
com.aiaioo.VaklipiOutputFixture | ||
program | run() | |
p is 150. If p is greater than 200, say “expensive” else say “not expensive”. | not expensive |
fit.Summary |
We can also say things like:
Say “boo” if 10 plus 2 is greater than 3.
Here below is a set of examples in English:
com.aiaioo.VaklipiOutputFixture | ||
program | run() | |
Say “boo” if 10 plus 2 is greater than 3. | boo | |
x = 2. y is 3. If x is less than y, print y else print x. | 3.0 | |
x = 2. y is 3. If x is more than y, max is x else max is y. Say max. | 3.0 |
fit.Summary |
Now, if you were talking Hindi, you would say something like:
अगर ३ का मान २ से ज्यादा है तो ३ बोलो. (If 3 is greater than 2, say 3)
com.aiaioo.VaklipiOutputFixture | ||
program | run() | |
अगर ३ का मान २ से ज्यादा है तो ३ बोलो. | 3.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.