ruby - Rails check if an array exists -
sorry noobish question; started developing rails. checked through api, documentation, , did bunch of searches not find for.
is there method check see if specific array exists?
for example,
array = [] array = [2,3,4] if array.exists? puts "array exists!" else puts "no such thing!" end
thanks
like so:
if defined?(array)
instance variables (eg @array) default nil, can test them
if @array
Comments
Post a Comment