Chapter review
Terminology
Operator and Operation - Operators are symbols that cause an operation, or interaction to happen between two pieces of data. An example operation would be
5 + 5
.(5 + 5) * 2
would be two operations.Modulo and Modulus - Modulo is a special type of arithmetic operation between two numbers using a modulus operator. The modulus is represented by a
%
(percent symbol). Example:24 % 2 == 0
Variable and Value - Variables are names that reference a certain piece of data. The value is what is stored inside the variable:
variable = "value"
Statement - This is when you do something, like an operation (or group of operations), declare a variable, or invoke a function. For instance, this is a print statement:
print("hello")
Invoke - Run/call a function.
Parameter and Argument - Functions tell you what and how many parameters they have. Arguments are the data that gets passed into those parameters.
Boolean -
true
orfalse
Equality - Whether or not two things are equal. This is usually done with an equal (
==
) comparison.Loop - Code that repeats.
Key and Index - Key is the named reference in a table where data can be found. It is similar to a variable. Index is a key that comes in an ordered sequence, such as numbered keys in a list. The plural of index is indices.
Iterate - Loop over a list and do something with it.
Scope - An area where variables can be created that aren't accessible from the outside. Scopes are created by functions and loops.
Local and Global - Local describes things accessible only in the current scope, such as local variables. Global things are accessible from anywhere in the program.
Shadowing - When a local variable has the same name as a variable in a parent scope and prevents you from accessing the parent scope variable.