In ruby, only the keywords "nil" and "false" evaluates to be false. Everything else (including empty strings/arrays and "0") evaluates to be true. Here are some examples:

class Human
attr_reader :name
def initialize(surname)
@name = surname
end
def greeting
puts "hello everybody"
false
end
def hungry
puts "I am hungry"
true
end
end
john = Human.new(nil)
if john.name
puts "john has a surname which is '#{john.name}'"
else
puts "john has no surname"
end
if john.greeting
puts "this is a geniune greeting"
else
puts "this is a sarcastic greeting"
end
if john.hungry
puts "John is genuinely hungry"
else
puts "John is lying and isn't that hungry"
end

This outputs:

PS C:\temp\irb> ruby .\if-else.rb
john has no surname
hello everybody
this is a sarcastic greeting
I am hungry
John is genuinely hungry
PS C:\temp\irb>

One of the things commonly done, is to use an if-else statment to determine a value for a variable. Here is an example where we are trying to determine the value of the variable called "message":

a_number = 13
if a_number < 10
puts "#{a_number} is less than 10"
message = "Hence this is a small number."
else
puts "#{a_number} is greater than 10"
message = "Hence this is a big number."
end
puts message