Undefined values: Difference between revisions

→‎{{header|Perl}}: Be more specific in the printing.
(added ruby partially)
(→‎{{header|Perl}}: Be more specific in the printing.)
Line 10:
 
# Check to see whether it is defined
print "var iscontains an undefined value at first check\n" unless defined $var;
 
# Give it a value
Line 17:
# Check to see whether it is defined after we gave it the
# value "Chocolate"
print "var iscontains an undefined value at second check\n" unless defined $var;
 
# Give the variable an undefined value.
Line 26:
# Check to see whether it is defined after we've explicitly
# given it an undefined value.
print "var iscontains an undefined value at third check\n" unless defined $var;
 
# Give the variable a value of 42
Line 33:
# Check to see whether the it is defined after we've given it
# the value 42.
print "var iscontains an undefined value at fourth check\n" unless defined $var;
 
# Because most of the output is conditional, this serves as