Constants, Variables and Operators in Programming
This section introduces fundamental programming concepts related to data storage and manipulation. It covers the differences between constants and variables, various types of operators, and how they are used in code.
Constants and Variables
The guide explains how data can be stored as either constants or variables in programming:
Definition: A constant is a data value that cannot be changed once assigned, typically set at the start of a program.
Definition: A variable is a data value that can be modified at any time during program execution.
Highlight: It's considered good practice to name constants using all uppercase letters.
Assignment and Comparison Operators
The document outlines the use of assignment and comparison operators:
Example: The assignment operator = is used to give values to variables, such as: name = "Gregg" or age = 34.
Vocabulary: Comparison operators are used to compare values, including ==, !=, <, >, <=, and >=.
Highlight: It's crucial to distinguish between the assignment operator = and the equality comparison operator ==.
Arithmetic Operators
The guide lists common arithmetic operators used in programming:
Example: Arithmetic operators include + addition, - subtraction, * multiplication, / division, ^ exponentiation, DIV quotient, and MOD or % remainder.
Highlight: Computers follow the BIDMAS Brackets,Indices,Division,Multiplication,Addition,Subtraction order of operations, so proper use of brackets is important for correct calculations.