pause at 3:00

This commit is contained in:
2026-01-13 03:16:55 +01:00
parent 12e73411bf
commit 42fa021a2a
5 changed files with 466 additions and 0 deletions

View File

@@ -23,3 +23,62 @@ Console.WriteLine("Happy birthday to you" + name)
Console.WriteLine("you are " + age + "years old")
}
```
## return
```C#
double x = 5.3;
double y = 3;
double result = Multiply(x,y)
static double Multiply(double x, double y){
double z = x * y;
return z;
}
```
## method overloading
```C#
double x = 5.3;
double y = 3;
double z = 3;
double result = Multiply(x,y)
// Will return the first Multiply method
double result = Multiply(x,y,z)
// Will return the second Multiply method
static double Multiply(double x, double y){
double z = x * y;
return z;
}
static double Multiply(double a, double b, double c){
double z = x * y;
return z;
}
```
## params
params keyword a method parameter that takes a variale number of arguments.
the parameter type must be a single - dimensional array
```C#
double total = CheckOut(3.99, 5,75, 15);
static double Checkout(params double[] prices){
double total =0;
foreach(double price in prices)
{
total += prices;
}
return total;
}
```