15/20 why isnt this correct?

puts 1 < 2 ? "One is less than two" : "not"

You changed an if into an if/else. They ask to refactor the code, not change its logical structure.

nevermind, was using ternary instead of one-liners

1 Like

So what is it meant to be?

puts β€œwords” if truebooleanstatement

Make some substitutions to that and you should be good to go @sherifeji

yeah so what does it mean


As @arjofocolovi said I originally put an else statement rather than just using an if statement.
What @luminaire is showing is the structure of a one line if statement. as an example

puts "6 is less than ten!" if 6 < 10

puts is the action that Ruby will take if the β€œif” statement is true. Anyting in β€œβ€ will be printed using puts. Then we use the β€œif” to add a condition to print β€œ6 is less than ten!”.

I could of confused you more but i hope it helps haha

okay thank you for the help.

I did:
puts β€œOne is less than two.” if 1 < 2
It keeps giving me the error: Oops, try again. Make sure your β€˜if’ statement still has the same behavior. It should puts β€˜One is less than two!’

I found me problem. Why does it have to be so picky?

You should add β€œ!” to the end of yours puts:
puts 1 < 2 ? β€œOne is less than two!” : β€œnot”