Ruby - Arrays
Why does compact! return nil sometimes instead of an array?
Why does compact! return nil sometimes instead of an array?
compact! returns nil if it did not remove any nil values from the array.nil values, there is nothing to remove, so compact! returns nil to indicate no change.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions