16/13 Answer

This question tripped me up a for a decent amount of time and even though the answer was posted within the forum. I wanted to share how I came to mine using the code ruby provided. The answer stated previously within this forum for this question resembled too much like example instead of the actual problem code academy gave for ex.

Example from ruby

three = 3
puts three == 3 ? “Of course.” : “What?”

Answer that worked for me and my logic :

problem was: Refactor the if statement in the editor to use a ternary operator to puts the correct sentence.

if 1 < 2
puts “One is less than two!”
puts “One is not less than two.”

my answer:

puts 1 < 2 ? “One is less than two!” : “One is greater than two?” – worked

this is open for commentary but for the ternary operator does the order matter and also does a question mark have to be in the incorrect statement if that makes sense

1 Like

it took me less than a minute to figure it out.