R
r
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
test()
In python this is perfectly valid, must i write a class for
everything? Also how does ruby handle modules compared to python? In
python i can do "import testscript" and access the function and array
as...
py> testscript.function('hello')
py> testscript.cams[0]
I can also do "from testscript import cams, function" and then do
py> cams[0]
py> function('hello')
Does anybody know of a good Python2Ruby.tut() ??
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
test()
In python this is perfectly valid, must i write a class for
everything? Also how does ruby handle modules compared to python? In
python i can do "import testscript" and access the function and array
as...
py> testscript.function('hello')
py> testscript.cams[0]
I can also do "from testscript import cams, function" and then do
py> cams[0]
py> function('hello')
Does anybody know of a good Python2Ruby.tut() ??