Advertisement
skipter

Try- Catch

Sep 21st, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. namespace NumberChecker
  2. {
  3.     using System;
  4.     public class Program
  5.     {
  6.         static void Main()
  7.         {
  8.             try
  9.             {
  10.                 var word = int.Parse(Console.ReadLine());
  11.                 Console.WriteLine("It is a number.");
  12.             }
  13.             catch
  14.             {
  15.                 Console.WriteLine("Invalid input!");
  16.             }
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement