I am calling sort on an array like this:
new_list = my_array.sort
The error I am getting is:
NoMethodError: undefined method `<=>' for nil:NilClass
How do I handle nil cases for this simple sort?
I initially had a destructive sort call (i.e. sort!) and changed it to the regular sort, but it still throws this error.
Thoughts?
Well, I assume you don’t need/want the nils, so…