> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/o/order_two_numerical_lists.md).

# Order two numerical lists

Built-in, via the comparison operator (\`<=>\`):

```ruby
func ordered(a, b) {
    (a <=> b) < 0
}
 
for p in [
    Pair([1,2,4], [1,2,4]),
    Pair([1,2,4], [1,2]  ),
    Pair([1,2],   [1,2,4]),
] {
    var a = p.first
    var b = p.second
    var before = ordered(a, b)
    say "#{a} comes before #{b} : #{before}"
}
```

#### Output:

```
[1, 2, 4] comes before [1, 2, 4] : false
[1, 2, 4] comes before [1, 2] : false
[1, 2] comes before [1, 2, 4] : true
```
