Variables

1. variable

1.3. Use Cases

Performing calculations (e.g., computing a total price).

Evaluating conditions (e.g., checking if a user is eligible).

Manipulating data (e.g., concatenating strings).

Examples

Arithmetic: total = price * quantity

Relational: isEligible = age >= 18

Logical: canVote = isCitizen && age >= 18

String Concatenation: greeting = "Hello, " + name

Notes

Operator Precedence: Determines the order of operations (e.g., * before +). Use parentheses for clarity (e.g., (x + y) * z).

Type Compatibility: Ensure operands match the expected type (e.g., cannot add a string and an integer directly).

Side Effects: Some expressions (e.g., x++) modify variables.