From: Louis-Philippe Date: 2008-12-31T06:25:45+09:00 Subject: Re: Ruby Noobie needs some help ------=_Part_158855_7438943.1230672378842 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline While a python2ruby tutorial is not a bad idea, If you want to understand ruby you have to learn to think like ruby, and starting to learn ruby by comparison, specially to a very different language, would be backward thinking a little. I would recommend you start with pure ruby tutorial: http://tryruby.hobix.com/ http://poignantguide.net/ruby/ if you like the language and want to learn it, go for the pickaxe book: http://www.pragprog.com/titles/ruby/programming-ruby 2008/12/30 Robert Dober > On Tue, Dec 30, 2008 at 9:49 PM, r wrote: > > Hello, > > I am coming from the python world and trying to learn ruby. Why does > > this throw an error? > > > > #testscript.rb > > cams = ['cam1', 'cam2', 'cam3'] > > def function(s) > > puts s > > for x in cams > > print x > > end > > end > methods defined with def are not closures. > Try this > module X > cams = ... > define_method :function do |s| > puts s > cams.each do | cam | print cam end > end > end > > include X > function > > This is however probably not what you want to do > > > test() > test???? did you mean function ? > > > > > Does anybody know of a good Python2Ruby.tut() ?? > Not me unfortunately. > > > > > HTH > Robert > > ------=_Part_158855_7438943.1230672378842--