Subject: Re: Calling functions
	Date: Mon 04 Nov 13 05:51:12PM +0100
Sorry for the delay!

Quoting Richard Curteis (lists / ruby-forum.com):

> Don't know how I missed that, I have ageChecker in the version I'm using 
> here but it still returns the following error after returning what the 
> user enters as age.
> 
> ./revtest.rb:23:in `ageChecker': undefined local variable or method 
> `age' for main:Object (NameError)
>   from ./revtest.rb:14:in `output'
>   from ./revtest.rb:57:in `<main>'
> 
> Is this to do with with the variable 'age', not being exported from the 
> output function?

You should carefully study the part of whatever tutorial or book you
are using, where it describes the scope of variables. The variables
you define in 'output' can only be seen from within that method. To
have variables with external visibility you should either use global
variables (prepend a '$' to the variable name), or, better,
encapsulate your example in a class and use class instance variables
(prepended with a '@').

Carlo

-- 
  *         Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido / fluido.as             che bisogno ci sarebbe
  *               di parlare tanto di amore e di rettitudine? (Chuang-Tzu)