Testing for undefined variables in ruby.

preview_player
Показать описание
How to test for undefined variables in ruby.

If you are coming from PHP this is similar to the isset() function. If you are coming from JavaScript it is similar to if (variable_name === undefined).

The script at the end.

variable_name = ""

if !defined?(variable_name)
puts "not defined"
else
puts "defined"
end
wait = gets
Рекомендации по теме
visit shbcf.ru