Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Undefined-values/Ruby/undefined-values.rb
Normal file
15
Task/Undefined-values/Ruby/undefined-values.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Check to see whether it is defined
|
||||
puts "var is undefined at first check" unless defined? var
|
||||
|
||||
# Give it a value
|
||||
var = "Chocolate"
|
||||
|
||||
# Check to see whether it is defined after we gave it the
|
||||
# value "Chocolate"
|
||||
puts "var is undefined at second check" unless defined? var
|
||||
|
||||
# I don't know any way of undefining a variable in Ruby
|
||||
|
||||
# Because most of the output is conditional, this serves as
|
||||
# a clear indicator that the program has run to completion.
|
||||
puts "Done"
|
||||
Loading…
Add table
Add a link
Reference in a new issue