​
The example program below shows a couple of ways to output text:
​
using System;
​
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello World!"); // relies on "using
System;"
Console.Write("This is");
Console.Write("... my first program!\n");
System.Console.WriteLine("Goodbye World!"); // no "using" statement
required
}
}
The above code displays the following text:
​
​
Hello World!
This is... my first program!
Goodbye World!
​
‘Build an egg timer using SnapsLibrary; - 'https://ptgmedia.pearsoncmg.com/images/9781509301157/samplepages/9781509301'157.pdf
​
'Begin to Code with C#
'Rob Miles
'PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way 'Redmond, Washington 98052-6399 Copyright © 2016 by Rob Miles.
​
class Ch03_12_EggTimerStart
{
public void StartProgram()
{
SnapsEngine.SetTitleString("Egg Timer");
SnapsEngine.DisplayString("There are five minutes left");
SnapsEngine.Delay(60);
SnapsEngine.DisplayString("There are four minutes left");
}
}
​
