Boolean Logic Quiz

Which of the following are objects in ruby?

nil true false and

Comparators like equal (==), less-than (<), and="" greater-than="" (="">) are ruby methods.

True False

Which of the following objects are truthy?

true false "true" "false" nil 0 1
puts true == "true" # .. A
puts "A" < "B" # ....... B
puts 15 <= 15.0 # ...... C
puts 15 <= "15" # ...... D
puts nil == false # .... E
puts !!nil # ........... F
puts !!0 # ............. G

Which of the above expressions will print true?

A B C D E F G

results matching ""

    No results matching ""