Just like spoken languages, programming languages have statements.

“A = 5” is a programming language statement.
In this case, the statement says a variable named A has the number 5 stored in it.
This is called an assignment statement because we're assigning a value to a variable.
To express more complex things, we need a series of statements, like “A is 5, B is ten, C equals A plus B”
This program tells the computer to set variable
‘A’ equal to 5, variable ‘B’ to 10, and finally to add ‘A’ and ‘B’ together, and put that result, which is 15, into -- you guessed it -- variable C.

So, we must “initialize” our variables, that is, set their initial value:

Control Flow Statements.

If Statements are the most common.

To repeat some statements many times, we need to create a conditional loop.
One way is a while statement, also called a while loop.

There’s also the common For Loop.
Instead of being a condition-controlled loop that can repeat forever until the condition is false,

a FOR loop is count-controlled; it repeats a specific number of times.

a new level of abstraction!
To compartmentalize and hide complexity, programming languages can package pieces of code into named functions, also called methods or subroutines in different programming languages.
These functions can then be used by any other part of that program just by calling its name.

So instead, software consists of thousands of smaller functions, each responsible for different features.
In modern programming, it’s uncommon to see functions longer than around 100 lines of code,

Modularizing programs into functions not only allows a single programmer to write an entire app,

Different programmers can work on different functions, and if everyone makes sure their code works correctly, then when everything is put together, the whole program should work too!

You have no rights to post comments