initial creation
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
|
||||
namespace HelloWorld
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
var a = 10;
|
||||
var b = 3;
|
||||
Console.WriteLine("Addition: " + (a + b));
|
||||
Console.WriteLine("Division: " + (a / b));
|
||||
// cast to float
|
||||
Console.WriteLine("Disivion using float: " + ((float)a / (float)b));
|
||||
|
||||
Console.WriteLine("Operator Precedence:");
|
||||
//Operator precedence
|
||||
var c = 1;
|
||||
var d = 2;
|
||||
var e = 3;
|
||||
Console.WriteLine("Normal precedence: " + (c + d * e));
|
||||
// Add c & d first then multiply by e
|
||||
Console.WriteLine("Addition first precedence: " + ((c + d) * e));
|
||||
|
||||
Console.WriteLine("Operator comparison:");
|
||||
//Comparison operators are always true or false
|
||||
// ! not, > greater than, < less than, equal to ==
|
||||
Console.WriteLine(c > d); //False
|
||||
Console.WriteLine(c == d); //False
|
||||
Console.WriteLine(c != d); //True
|
||||
Console.WriteLine(!(c != d)); //False
|
||||
|
||||
Console.WriteLine("Logical operators:");
|
||||
//Logical operators &&
|
||||
Console.WriteLine(e > d && e > c); //True
|
||||
Console.WriteLine(e > d && e == c); //False
|
||||
Console.WriteLine(e > d || e > c); //True
|
||||
Console.WriteLine(!(e > d || e == c)); //False
|
||||
|
||||
/*
|
||||
* used for multi line comment
|
||||
*/
|
||||
|
||||
/* Primitive Types
|
||||
integer
|
||||
character
|
||||
boolean
|
||||
*/
|
||||
|
||||
/* non-primitive types
|
||||
Arrays
|
||||
strings
|
||||
classes
|
||||
structures
|
||||
enums
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user