Josh Cheek wrote: > On Tue, Sep 8, 2009 at 8:13 PM, Chris Logan <t-logan3 / hotmail.com> > wrote: > # it sets it into the instance variable @input > # we use an instance variable because it will continue > # to exist outside the method. You know it is an instance > # variable because it begins with an @ symbol. If it did not, it > # would be a local variable, and "die" after the method returned. I do not fully understand this. > # the last line of a method is always returned, so in this case, > # we set the variable @input, and return it's value > # this is because the assignment operator, =, is itself a method > # which returns the value that was assigned. > def get_input > print "Say to deaf grandma: " #prompts the user for information > @input = gets.chomp #set @input, return it's value > end> > # p "did not shout".shouted? > # p "DID SHOUT".shouted? > # when we put a question mark on the end of a function or method, > # it indicates that a boolean value will be returned. A boolean > # value is just true or false. > class String > def shouted? > self == self.upcase #returns true if the string is uppercase > end > end Oh wow, I understood this that is really cool. > puts "NO, NOT SINCE #{get_year}!" #embed the year in the string else Do I use the # symbol? I read that that denotes a comment and anything after it would be ignored by Ruby. Hmm, I'll mull this over. This is really great information my next project should go MUCH easier, but I still don't understand why during reply == reply.upcase it was giving that blank line. I've reread the code a lot and I have no clue what would cause that. Thanks a bunch! -- Posted via http://www.ruby-forum.com/.