This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-14 13:29:50 +01:00
parent 99e528e51e
commit ddc33e2beb
4 changed files with 72 additions and 6 deletions

View file

@ -8,11 +8,11 @@
}
public static decimal sum()
{
int a = 3;
decimal b = 5;
decimal sum = a + b;
return sum;
{
int a = 3;
decimal b = 5;
decimal sum = a + b;
return sum;
}
private static decimal Sum(decimal a, decimal b)
@ -20,10 +20,16 @@
return a + b;
}
private static void ReturnNothing()
{
Console.WriteLine("Denne metoden returnerer ingenting");
}
public static void Run()
{
Console.WriteLine(sum());
Console.WriteLine(Sum(9,5));
Console.WriteLine($"Summen av 9 og 5 er: {Sum(9,5)}");
ReturnNothing();
}
}
}

View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IfElse", "IfElse\IfElse.csproj", "{ADAD2168-14E9-4D41-A651-74D0F952601F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ADAD2168-14E9-4D41-A651-74D0F952601F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADAD2168-14E9-4D41-A651-74D0F952601F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADAD2168-14E9-4D41-A651-74D0F952601F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADAD2168-14E9-4D41-A651-74D0F952601F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,34 @@
namespace CompareApp
{
class IsEqualOr
{
private static int num = 10;
private static int num2 = 10;
private static bool IsEqual = false;
static void Main(string[] args)
{
if (num == num2)
{
Console.WriteLine("Equal");
IsEqual = true;
}
else
{
Console.WriteLine("Not Equal");
IsEqual = false;
}
if (IsEqual)
{
num++;
Console.WriteLine(num);
}
else
{
num--;
Console.WriteLine(num);
}
}
}
}