Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0086 return statement

return statement is used to exit a method. It can pass value out of method. using System; class Program { static int add(int i, int j) { return i + j; } static void Main(string[] args) { int result = add(2, 3); Console.WriteLine(result); } } The output: 5