How to flip boolean variable from true to false in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            bool b;

            b = true;

            Console.WriteLine(b);

            b = !b;
            Console.WriteLine(b);

            b = !b;
            Console.WriteLine(b);
        }
    }
}


/*
run:
    
True
False
True
   
*/

 



answered Dec 2, 2016 by avibootz

Related questions

1 answer 297 views
1 answer 266 views
2 answers 293 views
1 answer 259 views
1 answer 238 views
1 answer 327 views
1 answer 288 views
...