Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Return the smaller of x[0] and y[0]
- #only return nil if both y[0] and y[0] are nil
- #x and y may possibly be empty arrays
- def min_first_element x, y
- if x[0] and y[0] #both are non-empty
- [x[0],y[0]].min
- elsif x[0]
- x[0]
- elsif y[0]
- y[0]
- else
- nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement