Knowledge Check!
Here’s a summary of what we learned in this lesson:
- About the concept of Variables for representing ‘data’ in our programs.
- About ‘int’ and ‘float’ variable types for numbers.
- About ‘boolean’ aka ‘bool’ variables for true/false values.
- About operators: + (add), - (subtract), *(multiply), and / (divivde)
- Putting it all together into a ‘madlib’ program
Class Discussion
- What is a variable in C# and why is it important?
- This question should encourage students to discuss the role of a program having ‘memory’
- Can you give examples of when you might use an ‘int’ variable? How about a ‘bool’?
- This is a fun question for students, take some time and let them imagine how to represent different type of of real-world values using these types
-
What is an operator in the context of programming and can you give examples of some common operators?
-
What does the Console.ReadLine()
function do and how might you use it in a program?
-
How did we use variables in our Madlib project?
-
Why is it important to choose the correct variable type for the data you want to store?
- What happens if you try to perform an operation with incompatible variable types (like adding a string and an int)?
- This is a tricky question because the results can depend on the types used in an expression. Ecourage students to try it and find an answer to the question in the class!*