Ruby - Variables and Data Types
What will the following Ruby code print?
value = nil if value puts "Yes" else puts "No" end
value = nil if value puts "Yes" else puts "No" end
nil in conditionsnil is treated as false in conditions.value is nil, the if value condition is false, so the else branch runs, printing "No".nil acts as false in if [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions