V
Venkat Akkineni
Hello
I have been trying to tranlate an application from java to ruby.
The java program has a main method for testing purposes. I am
implementing this
in ruby as a separate file. While doing this I noticed that puts doesn't
work from inside a method. Let me explain,
case 1:
#just this line in a file called something.rb
puts "something"
# The same line enclosed in a class
class Something
puts "something"
end
# The same line inside a method in a class doesn't work
class Something
def print_something
puts "something"
end
end
# I don't see the expected Output
Could somebody throw some light on this.
Thanks
Venkat
I have been trying to tranlate an application from java to ruby.
The java program has a main method for testing purposes. I am
implementing this
in ruby as a separate file. While doing this I noticed that puts doesn't
work from inside a method. Let me explain,
case 1:
#just this line in a file called something.rb
puts "something"
ruby something.rb
something
# The same line enclosed in a class
class Something
puts "something"
end
ruby something.rb
something
# The same line inside a method in a class doesn't work
class Something
def print_something
puts "something"
end
end
ruby something.rb
# I don't see the expected Output
Could somebody throw some light on this.
Thanks
Venkat