Skip to content

Instantly share code, notes, and snippets.

@rowanmiller
Last active April 20, 2017 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowanmiller/51ce554349981c7cadbe83c8cd9ae795 to your computer and use it in GitHub Desktop.
Save rowanmiller/51ce554349981c7cadbe83c8cd9ae795 to your computer and use it in GitHub Desktop.
Sample Code
using System;
namespace ConsoleApplication2
{
public class Program
{
public static void Main()
{
int mark = 66;
if (mark >= 60)
Console.WriteLine("Pass");
else
Console.WriteLine("Fail");
Console.WriteLine("Good bye");
Console.ReadLine();
}
}
}
// using System;
namespace ConsoleApplication2
{
public class Program
{
public static void Main()
{
double Temp = 19D;
If (Temp <> 20);
Console.WriteLine("The weather is moderate");
Console.WriteLine("Nice weather, let us go outside");
else
Console.WriteLine("Weather ?!");
}
}
var person = new { Name = "Jeff", Age = 20 };
var s = $"{person.Name} is {person.Age} year(s) old";
Console.WriteLine(s);
var person = new { Name = "Jeff", Age = 20 };
var s = $"{person.Name:20} is {person.Age:D3} year(s) old";
Console.WriteLine(s);
var person = new { Name = "Jeff", Age = 20 };
var s = $"{person.Name} is {person.Age} year {(person.Age == 1 ? "" : "s")} old";
Console.WriteLine(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment