I'm trying to sort an array, but for the exercise I can't use the sort method.
Since I also have to return the empty array, as well as one with only one item in it, I kinda cheated around those. Technically I only have to sort up to three items, but this seems like a situation to use while maybe?
Here's what I've got so far.
def my_sort(input)
if input[0] == nil
print "[]"
elsif input[1] == nil
print "[" + input[0].to_s + "]"
end
end
I'm wondering if I should be breaking this into strings or if there's some kind of .each do || that can be done.