Mega Code Archive

 
Categories / C# Tutorial / Class
 

Return int from function

Methods return a value to the calling routine using this form of return: return value; value is the value returned. using System; class MainClass {    public static int GetHour()    {       return 123;                       }    static void Main()    {       Console.WriteLine("Hour: {0}", GetHour());    } } Hour: 123