/* * 示範布林變數、關連運算、邏輯運算 * 9/19/2008 */ using System; namespace UsingLB { class Program { static void Main(string[] args) { bool x = 7 > 3; bool y = 2 < 0; Console.WriteLine("x = " + x); Console.WriteLine("y = " + y); bool xORy = x | y; Console.WriteLine("x | y :" + xORy); bool xANDy = x & y; Console.WriteLine("x & y :" + xANDy); bool xOy = (x & y) | (x | y); Console.WriteLine("(x & y) | (x | y) :" + xOy); bool xNy = (x & y) & (x | y); Console.WriteLine("(x & y) & (x | y) :" + xNy); } } }