return
return exits the current method, optionally returning a value.
static void PrintNumbers(){ for (int i = 1; i <= 5; i++) { if (i == 3) return; Console.WriteLine(i); }}PrintNumbers();Run the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”12