jwood803
1/6/2014 - 9:31 PM

Ruby examples

Ruby examples

name = "Jon"
if !employee.fulltime?
  puts "Employee is not full time."
end

unless employee.fulltime?
  puts "Employee is not full time."
end
3.times { puts "Hi!" }

Result

Hi!
Hi!
Hi!
puts "Hello"
print "there!"

Result

Hello
there!
"3".length

Result

1

3.length

Result

(eval):1: undefined method `length' for 3:Fixnum (NoMethodError)
puts "Ruby".downcase.upcase.reverse

Result

YBUR