python go [python이 확실히 더 직관적이다.] 루비는 다시 볼 것
<<<<<<<<<<<<<<<<<<<<<< python >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
print(" ============= << AND >> ===============")
print("True and True =>", True and True)
print("True and False =>",True and False)
print("False and True =>",False and True)
print("False and False =>",False and False)
print(" ============= << OR >> ===============")
print("True OR True =>",True or True)
print("True OR False =>",True or False)
print("False OR True =>",False or True)
print("False OR False =>",False or False)
print(" ============= << NOT >> ===============")
print(not True)
print(not False)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GO >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
package main
import "fmt"
func main() {
fmt.Println(" ====== OR ==============")
fmt.Println(" true OR true =>", true || true) // 1 or 1 = 1
fmt.Println(" true OR false =>", true || false) // 1 or 0 = 1
fmt.Println(" false OR true =>", false || true) // 0 or 1 = 1
fmt.Println(" false OR false =>", false || false) // 0 or 0 = 0
fmt.Println(" ====== AND =============")
fmt.Println(" true AND true =>", true && true) // 1 and 1 = 1
fmt.Println(" true AND false=>", true && false) // 1 and 0 = 0
fmt.Println(" false AND true =>", false && true) // 0 and 1 = 0
fmt.Println(" false AND false=>", false && false) // 0 and 0 = 0
fmt.Println(" ====== NOT =============")
fmt.Println(" !true " , !true)
fmt.Println(" !false ",!false)
}
< 루비 >
puts " <<< AND >>>"
puts true and true
puts true and false
puts false and true
puts false and false
puts " <<< && >>>"
puts true && true
puts true && false
puts false && true
puts false && false
puts " <<< OR >>> "
puts true or true
puts true or false
puts false or true
puts false or false
puts " <<< || >>>"
puts true || true
puts true || false
puts false || true
puts false || false
<<< AND >>>
true
true
false
false
<<< && >>>
true
false
false
false
<<< OR >>>
true
true
false
false
<<< || >>>
true
true
true
false
puts "true and true => ", TRUE and TRUE
puts "false and true => ", FALSE and TRUE
puts "true and false => ", TRUE and FALSE
puts "false and false => ", FALSE and FALSE
puts "true or true => ", TRUE or TRUE
puts "false or true => ", FALSE or TRUE
puts "true or false => ", TRUE or FALSE
puts "false or false => ", FALSE or FALSE
puts "not true => ", !true
puts "not false => ", !false
'언어 > 비교' 카테고리의 다른 글
dividen (0) | 2016.03.25 |
---|---|
python vs ruby (0) | 2016.02.13 |
python vs ruby (0) | 2016.02.13 |
ruby vs python (0) | 2016.02.10 |