Mar 25, 08:51 AM
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 |
Run test
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 |
Run test
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 |
Run test
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.
— Cohan Sujay Carlos
Vaklipi,
Mar 24, 11:08 PM
When programming a computer, you refer to values using names called variables, like so:
y = 2. x = y + 3.
Here in the first sentence, you’re saying that y is a variable of value 2.
In the second sentence, you’re saying that x is a variable that is 3 more than y.
The reason we need to use names like x and y is because they make it easier to make a sequence of changes to a value.
Take the following instructions.
x is 2. Increment it by 13. What is the value of x?
We needed to use x in the third sentence to indicate the value that was incremented by 13.
Just remember that that’s what variables do. They name numbers.
Now, here is another useful way to think about variables:
When I was a kid, I used the mental picture of a box in which a number was stored.
The name of the box was the variable’s name. So, you could think of x as the name of a box that stores the value 15 (was 2 before it was incremented by 13).
In Vaklipi, you would write the above command sequence as:
x is 2. Increment x by 13. What is x?
(Vaklipi doesn’t yet support coreferencing – using prepositions like ‘it’ – but will in the near future).
You could also write:
x is equal to 2. What is x?
as shown in the following demo.
com.aiaioo.VaklipiOutputFixture |
program |
run() |
x is equal to 2. What is x? |
2.0 |
x is 7. Increment x by 7. What is x? |
14.0 |
Run test
We can also put text snippents (called strings) into variables in the same way.
com.aiaioo.VaklipiOutputFixture |
program |
run() |
x is 6. What is x? |
6.0 |
Var x is “Mango”. What is x? |
Mango |
Variable x is equal to false. What is x? |
false |
Run test
In Hindi, you would say something like:
पा ३ है. (pa is 3.)
or
पा का मान ३ है. (pa’s value is 3.)
com.aiaioo.VaklipiVariableFixture |
program |
variable |
run() |
पा का मान ३ है. |
पा |
3.0 |
Run test
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.
— Cohan Sujay Carlos
Vaklipi,
Mar 24, 08:45 PM
If you wanted a child to say Hello to you. You would give the child a very simple instruction:
Say “Hello”.
There is a tradition to start learning programming with a program that prints “Hello, World!” on the screen.
In Vaklipi this is very easy. All you have to do is issue the command:
Say “Hello, World!”.
as shown in the following demo.
com.aiaioo.VaklipiOutputFixture |
program |
run() |
Say “Hello, World!”. |
Hello, World! |
Run test
Run it.
There! You have just run your first program that ‘did’ anything at all to the world around it, in Vaklipi!
In the demo:
- The first column contains the command to run
- The second column contains the expected output of the command
Of course, humans have other ways of getting someone to say something. For instance, if I wanted you to say 6, I would ask you:
What is 2 * 3?
That works for Vaklipi as well.
com.aiaioo.VaklipiOutputFixture |
program |
run() |
What is 2 * 3? |
6.0 |
Run test
In Hindi, you would say something like:
“दुनिया प्रणाम” बोलो. (“duniya pranaam” bolo.)
com.aiaioo.VaklipiOutputFixture |
program |
run() |
“दुनिया प्रणाम” बोलो. |
दुनिया प्रणाम |
“क्या हाल है” बोलो. |
क्या हाल है |
Run test
Learn
You can learn programming with Vaklipi in the following pages:
- Introduction: Learn about 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.
— Cohan Sujay Carlos
Vaklipi,
Jan 23, 07:38 PM
Vaklipi
The Vaklipi language lets you program using a natural language, for example, English or Hindi. You no longer have to learn the complex syntax of a formal programming language in order to make a computer or a robot do what you want.
You can say things to your computer like:
What is 5 * 2?
Uses
Writing complex software requires a complex programming language. However, a user of the software should not have to learn such a complex programming language.
Now, you can do simple programming tasks around a piece of software, like querying a database or doing something to a file on a computer without learning a formal programming language.
You can do this using the convenience of natural language. Moreover, you can do this using YOUR OWN natural language, the language that you use when you wake up in the morning. And asking for a database record does not have to be more complex than asking for a cup of tea.
Demos
In the rest of the articles, you will see demos like the tables below. The tables are little tests that can be executed by you.
Click on the “Run Test” link to run the tests. If they run successfully, the last column of the table will turn green.
The tables titled VaklipiVariableFixture are structured as follows:
- The first column contains the command to run
- The second column contains the variable to be examined after the command is run
- The third column contains the expected value of the variable
English
com.aiaioo.VaklipiVariableFixture |
program |
variable |
run() |
The variable X is equal to 3. |
X |
3.0 |
Variable Y equals 8. |
Y |
8.0 |
Set Z to 9. |
Z |
9.0 |
Run test
When you click the link “Run test” to execute the English test, you should see the numbers 3.0, 8.0 and 9.0 turning green.
The green colour is a sign that the tests ran fine.
The first test is a command:
The variable X is equal to 3
to set the variable X to 3. The last two columns ask the testing tool to check if the value of X is 3.0 after the program is executed.
Hindi
com.aiaioo.VaklipiVariableFixture |
program |
variable |
run() |
ता का मूल्य ३ है. |
ता |
3.0 |
Run test
Learn
You can learn programming with Vaklipi in the following pages:
- 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.
— Cohan Sujay Carlos
Vaklipi,