<p>Is there a better way than the following to check to see if a string is nil OR has a length of 0 in Ruby?</p>

<pre class="lang-ruby prettyprint-override"><code>if !my_string || my_string.length == 0
  return true
else
  return false
end
</code></pre>

<p>In C# there's the handy</p>

<pre class="lang-csharp prettyprint-override"><code>string.IsNullOrEmpty(myString)
</code></pre>

<p>Anything similar to that in Ruby?</p>

Every class has a
```
nil?
```
method:
```
```
if a_variable.nil?
    # the variable has a nil value
end
```
```
And strings have the
```
empty?
```
method:
```
```
if a_string.empty?
    # the string is empty
}
```
```
Remember that a string does
not
equal
```
nil
```
when it is empty, so use the
```
empty?
```
method to check if a string is empty.