序言

本文为 Crash Course Computer Science内的内容的笔记

布尔代数的基本

  • 变量的值: True False
  • 逻辑运算符: NOT, AND, OR, XOR

逻辑运算符

  • NOT : 翻转布尔值 (True -> False, False -> True)

  • AND : 只有两个变量都为True时,结果才为True (True AND True -> True, True AND False -> False, False AND False -> False)

  • OR : 只有两个变量中有一个为True时,结果才为True (True OR True -> True, True OR False -> True, False OR False -> False)

  • XOR : 只有两个变量中有一个为True时,结果才为True (True XOR True -> False, True XOR False -> True, False XOR False -> False)

图像

NOT AND OR XOR