How to convert expressions to boolean in C#

1 Answer

0 votes
using System;

public static class Program
{
    public static void Main()
    {
        int x, y;

        x = 5;
        y = 5;

        bool b = Convert.ToBoolean(x == y);

        Console.WriteLine(b);
    }
}




/*
run:

True

*/

 



answered Nov 15, 2021 by avibootz
edited Nov 16, 2021 by avibootz

Related questions

1 answer 198 views
1 answer 162 views
162 views asked Nov 16, 2021 by avibootz
1 answer 175 views
1 answer 163 views
1 answer 1,424 views
...