Operators & Expressions
I will show you how to perform calculations and make decisions. You will learn arithmetic, comparison, and logical operators.
Lessons
1. Intro
The Goal
2. What is an Operator?
Operators transform values
3. Arithmetic Operators Overview
Basic math operations
4. Addition and Subtraction
Combining and removing values
5. Multiplication
Scaling values
6. Quiz: Basic Operations
Math operators
7. Division with Integers
Whole number results only
8. Division with Doubles
Full decimal answers
9. Quiz: Integer division
Integer division
10. The Modulo Operator
What is left over
11. Modulo Use Cases
Practical applications
12. Quiz: Modulo
Test modulo knowledge
13. Operator Precedence
Which operator goes first
14. Using Parentheses
Override default precedence
15. Quiz: Precedence
Test precedence rules
16. Assignment Operators
The equals sign
17. Challenge: Even or Odd
Use the modulo operator
18. Compound Assignment
Shorthand arithmetic
19. Increment and Decrement
Add or subtract one
20. Pre vs Post Increment
Timing of the change
21. Quiz: Operator basics
Operator basics
22. Quiz: Assignment
Test your understanding
23. Challenge: Maximum of Two
Compare two values
24. Comparison Operators Overview
Testing conditions
25. Equal and Not Equal
Checking sameness
26. Less Than and Greater Than
Ordering values
27. Less/Greater or Equal
Inclusive bounds
28. Quiz: Operator basics
Operator basics
29. Quiz: Comparison
Test comparison rules
30. Logical Operators Overview
Merging multiple checks
31. Logical AND
All conditions required
32. Quiz: Logical AND
Logical AND
33. Logical OR
Any condition sufficient
34. Logical NOT
Flipping true and false
35. Quiz: Logical AND
Logical AND
36. Short-Circuit Evaluation
Early exit optimization
37. Quiz: Logical Operators
Test logical rules
38. Problem - Check Even or Odd
Apply remainder operator
39. Problem - Leap Year Check
Multiple logical rules
40. Problem - Next Round
Count qualifiers
41. Next Round - The Idea
The threshold condition
42. Next Round - Algorithm
Breaking down the solution
43. Quiz: Operator basics
Operator basics
44. Next Round - Implementation
Complete solution
45. Lessons from Next Round
summary
46. Problem - Beautiful Year
Finding distinct digits
47. Beautiful Year - The Idea
Using modulo and division
48. Beautiful Year - Algorithm
Breaking down the solution
49. Quiz: Conditional execution
Conditional execution
50. Beautiful Year - Implementation
Complete solution
51. Lessons from Beautiful Year
summary
52. Section Recap
What we learned