From: Jason Lillywhite Date: 2008-05-17T00:52:31+09:00 Subject: newbie questions I feel like we need a Forum called, "Ruby Newbie" for people like me. Is there one? I am hoping someone could help me with the following (probably) simple questions (my nested questions are surrounded by **): 1. Someone said to use the following code for getting a string and printing to the screen: puts "Where do you live?" STDOUT.flush city = gets.chomp puts "I live in " + city **why not just do this:** puts "Where do you live?" city = gets() puts "I live in " + city ?? regarding STDOUT: the comment was made - STDOUT is a global constant which is the actual standard output stream for the program. **but is it necessary?** A comment was made: flush flushes any buffered data within io to the underlying operating system (note that this is Ruby internal buffering only; the OS may buffer the data as well). The usage is not mandatory but recommended. **I still don't understand why flush is recommended. Is my omission going to create a problem?** **I understand chomp to remove record separators from the end, is there another reason besides?** 2. Is there a place I can go to learn more about regular expressions? 3. In IRB, Float::DIG => 15 **question: This is because float displays to 15 decimals, right? **question: I see "::" all the time, but don't understand it. What does :: mean? Is it showing hierarchy? 4. In the code below: class NameIt def initialize(name) @name = name end def to_s puts "My name is: #{@name}" end end n1 = NameIt.new("tom") n2 = NameIt.new("sally") n1.to_s n2.to_s **the last 4 lines seem very repetative. this is something I've wondered for a long time. Is there a way to compact the last 4 lines if you are trying to list a whole bunch of names at once using the method to_s? thank very much! Jason -- Posted via http://www.ruby-forum.com/.