Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 421 Bytes

File metadata and controls

26 lines (19 loc) · 421 Bytes

is_array

We can check if a variable is an array in Ruby using Object#is_a?.

{{code:php $colors = array('red', 'green', 'blue'); $result = is_array($colors); var_export($result); // => true }}

{{code:ruby colors = ["red", "green", "blue"] p colors.is_a?(Array) # => true }}

{{related: var/is_float var/is_int var/is_string var/is_object }}