# Comparison

Equality operator (`==`) returns `true` when both operands are in the same currency and have an equal amount.

```dart
import 'package:money2/money2.dart';
fiveDollars == fiveDollars;  // => true
fiveDollars == sevenDollars; // => false
fiveDollars == fiveEuros;    // => false (different currencies)
```

Money values can be compared with the `<`, `<=`, `>`, `>=` operators, or the method `compareTo()` from the interface `Comparable<Money>`.

**These operators and method `compareTo()` can be used only between money values in the same currency. Runtime error will be thrown on any attempt to compare values in different currencies.**

```dart
import 'package:money2/money2.dart';
fiveDollars < sevenDollars; // => true
fiveDollars > sevenDollars; // => false
fiveEuros < fiveDollars;    // throws ArgumentError!
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://money2.onepub.dev/comparison.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
