Thomas Wieczorek
3/13/2008 10:10:00 AM
On Thu, Mar 13, 2008 at 2:32 AM, Gerry Ford <wade@zaxfuuq.net> wrote:
>
> Q1) What is the ruby analog to the perl use of strict and warnings?
>
I am not really experienced in Perl, but as I understand it. strict
enforces that you have to declare variables, so that when you mistype
something an error occurrs. You get a NameError in Ruby when you use a
variable which hasn't any value assigned:
# irb
# foo has a value
foo = "Hello"
puts foo # "Hello"
# bar is not declared
puts bar
# NameError: undefined local variable or method `bar' for main:Object
# from (irb):6
As far as I know you can't turn warnings on from your code, but you
can run Ruby with the "-w" option which shows warnings.