3. What the difference between IF and UNLESS?


#1

Could you please explain where the difference between if and unless?
If I understand correctly we use "if" when an even already have place now and "unless" before an event happend. Is it correct?


#2

unless is just a negated if. That is, it executes whatever it contains if the condition is not true.

unless foo?
    # blabla
end

Simply means

if !foo?
    # blabla
end

source


#3

Simply, the difference is "If not = unless".