- Programming is the art of writing instructions to the computer such that it achieves your desired task.
- Learning programming is a process of making mistakes and learning from them
- Do NOT get discouraged when you can't solve a challenge.
- A variable is used to store information so that you can use it and manipulate it later on.
- let age = 21 creates an age variable that is 21.
Anatomy of variable declarations
- let is a keyword that we use to create a new variable.
- It is then followed by the name of the variable.
- Then followed by the equal sign = which assigns it (or gives it a value)
- Then followed by the value of the variable.
Make sure to give descriptive names for your variables.
Variable Operations
- The first time you define a variable, you have to define it with let.
- The next time you use that variable, you should NOT use let anymore. Directly use the variable by its name.
- variable + 3 performs an operation that adds 3 to the variable. It does NOT modify the variable.
- Be careful of hardcoding. Do not replace variable + 3 with a number because we want our code to work for any value given to variable.
Addition and multiplication
- The + operator adds the 2 numbers on its left and right
- The * operator multiplies the 2 numbers on its left and right