pause at 31minutes

This commit is contained in:
2026-01-11 23:13:26 +01:00
parent 67ef71092a
commit 0a1934f95a
5 changed files with 160 additions and 1 deletions

View File

@@ -0,0 +1,84 @@
# Variables
## int
for storing integer
```c#
int age = 21;
```
## double
can store a decimal
```C#
double height = 300.5;
```
## bool
can store boolean
only true or false
```C#
bool alive = true;
```
## char
for a single carachter
```C#
char symbole = '@';
```
## String
don't forget the S in upper
```C#
String name = "Hello";
```
## constants
immutable values wich are known at compile time and
do not change for th life of the program
just add the const keyword
```C#
const double pi = 3.14;
```
## Type casting
Converting a value to a different data type
Very useful because user input will always be strings
```C#
double a = 3.14;
int b= Convert.ToInt32(a);
int c= 123;
double d= Convert.ToDouble(c);
int e= 321;
String d= Convert.ToString(e);
String g = "$";
char h = Convert.ToChar(g);
String i = "true";
bool j = Convert.ToBoolean(i);
```
## GetType
Get the type of a variable
```C#
double a = 3.14;
Console.WriteLine(a.GetType())
```