A static method that returns a Boolean value.

image_pdfimage_print
   
  

using System;

class MainClass{

    public static Boolean TestInput(int val) {
        if (val < 1 || val > 10)
            return false;
        return true;
    }

    public static void Main() {
        Console.WriteLine("TestInput(0) = {0}", TestInput(0));
        Console.WriteLine("TestInput(1) = {0}", TestInput(1));
        Console.WriteLine("TestInput(5) = {0}", TestInput(5));
        Console.WriteLine("TestInput(11) = {0}", TestInput(11));
    }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.