C# Lesson 3 - Variables and Data Types
There are many types of data, the following are just a few to get us started
Data type |
Description |
Example |
integer |
Whole Numbers |
1,2,3,4… |
boolean |
Two values |
True or False |
char |
A single character |
‘m’ |
String |
A sequence of characters |
“Menu” |
float |
A number with a floating point |
3.142 |
double |
A number with a floating point, but double the precision of a float |
3.14159265 |
There are other aspects to consider when selecting data types, such as how much data can it store? But we will cover that later.
Quick Quiz
Which data type would you choose to store the score of a game?
Which data type would you choose to a player’s name?
Which data type would you choose to store if a player was alive or dead?
Let’s see it in practice, Create a new console project and enter the following code.
Activity
Edit the code so you “The User” can input the name and score.
Hint: Use Console.Readline() |