Error in GITHUB

18 views
Skip to first unread message

Kagiso Samuel Ramolotja

unread,
Apr 14, 2015, 5:08:14 AM4/14/15
to rubyonra...@googlegroups.com
Hi, all

Please help with the following code, I think one line is giving the error. What can I do below to make the code to output 1,7,"Testing", nil, 321


def output_values(*values)
values.each do |value|
if value == nil
puts "Nil value"
return
end
 
puts value
end
end

Colin Law

unread,
Apr 14, 2015, 5:16:49 AM4/14/15
to rubyonra...@googlegroups.com
On 14 April 2015 at 09:45, Kagiso Samuel Ramolotja <kag...@aims.ac.za> wrote:
> Hi, all
>
> Please help with the following code, I think one line is giving the error.
> What can I do below to make the code to output 1,7,"Testing", nil, 321
>
>
> def output_values(*values)
> values.each do |value|
> if value == nil
> puts "Nil value"
> return

Why have you got a return here?

Colin

> end
>
> puts value
> end
> end
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/1542a82f-34bc-47b0-815d-33659e420196%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages