- Variable: information you can store for use later. This can be changed and redefined as needed.
- Mathematical operators: symbols that perform pre-defined operations.
- Type: classification of information.
- Number: any number. Can only include digits and the decimal point.
- String: any mix of letters, numbers, or symbols. To set a String value, use quotes around your value (for example: “Hello world!”)
- Boolean: True or False. We’ll discuss this data type more later!
- Function: a procedure or routine. These can be defined by the programming language or even by you! We will discuss creating your own functions in the Functions lesson.
- A couple examples we cover here are Text() and type()
What is a variable?
- Save information to use it later!
- Set the value of a variable using the equal sign
- For example: var = 2 sets a variable named var to the value 2
- Mathematical operators are allowed when using variables of the same type
- Use + to add
- Use - to subtract
- Use / to divide
- Use * to multiply
Types of variables
- “Code Shrew”
- Check the type of any variable using the type() function
Variables can change if needed!
- As you code longer scripts, you will find it useful to change the variables you have stored rather than creating another variable.
- You can increase a variable’s value or even redefine it completely.