Use the 'defined?' command to determine if a variable has already been set in a ruby script.
e.g. alpha = 'A' unless (defined?(alpha))
set the value of alpha to be 'A' unless it's already set. Yes, there are other shorter ways to do this particular. But, the example is still relevant.
Sunday, August 2, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment