Skip to content
Snippets Groups Projects
Commit b382bef7 authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

live11 alku

parent 64b5345f
No related branches found
No related tags found
No related merge requests found
using System;
/// @author Vesa Lappalainen
/// @version 10.10.2020
///
/// <summary>
/// Esimerkkejä
/// </summary>
public class Kertausta
{
public static void Main()
{
// BYCODEBEGIN
int a = 5;
int b = 3;
int tulo = a * b;
Console.WriteLine($"a = {a}, b = {b}, tulo = {tulo}"); // 1
a = 7;
Console.WriteLine($"a = {a}, b = {b}, tulo = {tulo}"); // 2
b = 2;
Console.WriteLine($"a = {a}, b = {b}, tulo = {tulo}"); // 3
// BYCODEEND
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
</Project>
public class WhileEsimerkki
{
public static void Main()
{
// BYCODEBEGIN
int raja = 4;
int askel = 1;
int count = 1;
while (count < raja)
{
System.Console.WriteLine(count);
count += askel;
}
// BYCODEEND
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
</Project>
public class WhileGoto
{
public static void Main()
{
// BYCODEBEGIN
int raja = 4;
int askel = 1;
int count = 1;
silmukka:
if (count >= raja) goto loppu;
{
System.Console.WriteLine(count);
count += askel;
goto silmukka;
}
loppu:;
// BYCODEEND
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ExternalConsole>true</ExternalConsole>
</PropertyGroup>
</Project>

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kertausta", "Kertausta\Kertausta.csproj", "{59FC60B6-FBC1-44A7-AC5E-7E7B79B63463}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59FC60B6-FBC1-44A7-AC5E-7E7B79B63463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59FC60B6-FBC1-44A7-AC5E-7E7B79B63463}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59FC60B6-FBC1-44A7-AC5E-7E7B79B63463}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59FC60B6-FBC1-44A7-AC5E-7E7B79B63463}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2FF93419-5E20-4085-BB71-3B6A5903E802}
EndGlobalSection
EndGlobal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment