E
E
Evsign2014-06-21 21:49:37
ruby
Evsign, 2014-06-21 21:49:37

How to check if a variable is empty in Ruby?

Actually the question is in the title) #receiving
a string from the user
user_input = gets.chomp
if user_input is empty?
code
end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evsign, 2014-06-21
@Evsign

This language is cool... Ruby)) As you think - so you write)
You can check the variable for emptiness using the .empty method ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question