> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/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/perl6-rosettacode/programming_tasks/i/integer_comparison.md).

# Integer comparison

```perl
my $a = prompt("1st int: ").floor;
my $b = prompt("2nd int: ").floor;

if $a < $b {
    say 'Less';
}
elsif $a > $b {
    say 'Greater';
}
elsif $a == $b {
    say 'Equal';
}
```

With `<=>`:

```perl
say <Less Equal Greater>[($a <=> $b) + 1];
```

A three-way comparison such as `<=>` actually returns an `Order` enum which stringifies into 'Decrease', 'Increase' or 'Same'. So if it's ok to use this particular vocabulary, you could say that this task is actually a built in:

```perl
say prompt("1st int: ") <=> prompt("2nd int: ");
```
