A
A
Alexey Kalinin2014-08-30 19:27:34
ruby
Alexey Kalinin, 2014-08-30 19:27:34

Why doesn't plain Ruby code work?

Started reading Ruby book, first listing if gives error "undefined method `saturday' for Sat Aug 30 19:23:32 +0300 2014:Time (NoMethodError)" code below

today = Time.now

if today.monday?
  puts "123"
elsif today.sunday?
  puts "relax"
else
  puts "Go work"
end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
beance, 2014-08-30
@beance

Working code.
By mistake, you changed monday to saturday and forgot to put a "?"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question