Member-only story
Links to previous chapters
Chapter 0 — Overview : click here
Chapter 1 — Understanding Data : click here
Chapter 2.1 — Operators : click here
Chapter 2 : Understanding Tools
Until now, we have learnt various topics in programmming. But if we observe carefullyu, all these topics are pretty much atomic concepts, i.e., we have learnt what inputs are , what data types are, what are the operators but we have yet to learn how to use all these building blocks to write a program. Well we are getting into to it, this section of the chapter will pave an introduction to it.
2.2 Statements
A statement is a command that the programmer gives to the computer. So basically we write bunch of statements as a program, which then followed by computer step by step to perform the necessary task. Let us look at few examples:
a = 10 + 20
b = 10 * 20
c = b - a
In the above example, each line is a statement. Each line tells the computer to perform a simple task.
- In line 1, we are adding 10 and 20 using + operator and then assigning the sum to a variable named a.
- In line 2, we are multiplying 10 and 20 using * operator and then assigning the product to a variable named b.
- In line 3, we are subtracting the variables a and b and then assigning the result to another variable named c.