Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'pry'
- first = 'FF'
- second = 'FB'
- third = ''
- test = Array.new
- test.push('')
- test.push('FB')
- test.push('FF')
- test.push('')
- test.push('FB')
- test.push('FF')
- test.push(first)
- test.push(second)
- test.push(third)
- # custom sort, should return FF < FB < ''
- puts test.sort do |left,right|
- if left == first && right == second
- -1
- elsif left == first && right == third
- -1
- elsif left == second && right == third
- -1
- elsif left == right
- 0
- else
- 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement