What is the difference between the following two lines?
num = 4
num == 4
Given the following code:
num = gets.chomp
if num == 4
puts "Hooray, four is the best!"
elsif num < 0
puts "Less than zero"
else
puts "I'm not familiar with that number..."
end
What will happen if the user enters: -1
? How about 4
? Or 15
?
If x
and y
are defined as:
x = 4
y = x
Will the following boolean expressions be true or false? Why?
(x == 4) && (y >= x + 1)
(x == 4) || (y >= x + 1)
What does
!true
mean?