Example #1
0
        static void Main(string[] args)
        {
            LectureExample test = new LectureExample();

            test.ReturnBigEvenNumber(100);


            //Console.WriteLine("*******************************");
            //Console.WriteLine("*** IF STATEMENTS ***");
            //Console.WriteLine("*******************************");
            //Console.WriteLine();

            //bool staplerIsSwingline = false;
            //if (staplerIsSwingline)
            //{
            //    Console.WriteLine("Better be red...");
            //}



            //int numberOfPeople = 25;
            //int slicesOfCake = 22;

            //if (numberOfPeople <= slicesOfCake)
            //{
            //    Console.WriteLine("Yummy! Cake!");
            //}
            //else
            //{
            //    Console.WriteLine("Burn the building down...");
            //}



            //Console.WriteLine("*******************************");
            //Console.WriteLine("*** VARIABLE SCOPE          ***");
            //Console.WriteLine("*******************************");
            //Console.WriteLine();

            //int firstVariable = 2;
            //if (firstVariable > 0)
            //{
            //    int secondVariable = firstVariable;
            //}
            ////int thirdVariable = secondVariable * 2; // this will cause a compile error because secondVariable is not "in scope"
            ////int firstVariable = 3;  // this is a compiler error because we already have a variable named firstVariable in this scope


            //Console.WriteLine("*******************************");
            //Console.WriteLine("********** METHODS ************");
            //Console.WriteLine("*******************************");
            //Console.WriteLine();
            //bool burnItDown = ShouldBurnDownTheBuilding(14, 20);

            //Console.WriteLine("Value of burnItDown: " + burnItDown);
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            LectureExample example = new LectureExample();

            int number = example.ReturnNotOne();

            Console.WriteLine(number);

            double doubleNumber = example.ReturnNotHalf();

            Console.WriteLine(doubleNumber);

            string name = example.ReturnName();

            Console.WriteLine(name);

            double singleValue = 10;
            double product     = example.ReturnDoubleOf(singleValue);

            Console.WriteLine(product);

            int    age      = 25;
            string category = example.ReturnAdultOrMinor(age);

            Console.WriteLine("Age " + age + " is a " + category);

            age      = 17;
            category = example.ReturnAdultOrMinor(age);
            Console.WriteLine("Age " + age + " is a " + category);

            age      = 18;
            category = example.ReturnAdultOrMinor(age);
            Console.WriteLine("Age " + age + " is a " + category);

            Console.ReadKey();
        }