Initializing a variable.
using System;
class MainClass{
public static void Main() {
// Initialize a variable at declaration
short x = 5;
// Initialize a variable as a copy of another
int y = x;
double z = y + 10.25;
int a = (int)z;
Console.WriteLine("X = {0} Y = {1} Z = {2}", x, y, z);
Console.WriteLine("A = {0}", a);
}
}
Related examples in the same category