zoukankan      html  css  js  c++  java
  • 第一节 9布尔运算符 简单

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    /*  布尔运算
     *  相等判断: ==, 不要和=混淆
     *  WriteLine("{0}",i==1); WriteLine("{0}",i=1); 的区别
     *  不等判断!=
     *  大小比较< > <= >=
     *  取返: !
     *  组合运算: && ||
     */
    namespace _9布尔运算符
    {
        class Program
        {
            static void Main(string[] args)
            {
                var i = 1;
                Console.WriteLine("{0}",i==1); //显示为true
                Console.WriteLine("{0}",i=1); //显示1C#中赋值表达式也有值,它的值表示为赋值后变量的值
    
                int i1 = 20;
                int i2 = 30;
                Console.WriteLine("{0}",i1>10 && i2<100);//&&并且,只有两边都是true的时候,&&的值才是true,否则就是false, true&&true就是true, true&&false还是false false&&true就是false
                Console.WriteLine("{0}",i1>200&&i2<100); //false
                Console.WriteLine("{0}",i1>200||i2<100); //true
                
                
                Console.ReadKey();
            }
        }
    }
    

      

  • 相关阅读:
    10 Iterable之遍历Map、Set、Array
    9 Map和Set
    8 循环
    5 字符串
    6 数组
    4 数据类型
    2 变量
    实现简单的邮件收发器(十二)
    10.19 初识django
    10.18 数据库之索引优化方案
  • 原文地址:https://www.cnblogs.com/xiangxiaodong/p/2358382.html
Copyright © 2011-2022 走看看