/
ex28.rb
64 lines (42 loc) · 1.12 KB
/
ex28.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# My guesses are listed after each puts statement
# I think a puts statement might only evaluate the first boolean statement, as "puts 1 == 1 and 2 == 1" evaluates to true. I'm going back and putting parentheses around each set of statements to fix this.
puts true and true
puts "true"
puts false and true
puts "false"
puts (1 == 1 and 2 == 1)
puts "false"
puts "test" == "test"
puts "true"
puts (1 == 1 or 2 != 1)
puts "true"
puts (true and 1 == 1)
puts "true"
puts (false and 0 != 0)
puts "false"
puts (true or 1 == 1)
puts "true"
puts ("test" == "testing")
puts "false"
puts (1 != 0 and 2 == 1)
puts "false"
puts ("test" != "testing")
puts "true"
puts ("test" == 1)
puts "false"
puts not(true and false)
puts "true"
puts not(1 == 1 and 0 != 1)
puts "false"
puts not(10 == 1 or 1000 == 1000)
puts "false"
puts not(1 != 10 or 3 == 4)
puts "false"
puts not("testing" == "testing" and "Zed" == "Cool Guy")
puts "true"
puts (1 == 1 and not("testing" == 1 or 1 == 0))
puts "true"
puts ("chunky" == "bacon" and not (3 == 4 or 3 == 3))
puts "false"
puts (3 == 3 and not ("testing" == "testing" or "Ruby" == "Fun"))
puts "false"