Skip to content

Commit e9bbf96

Browse files
Updated methods/operators section (#5719)
Fixes #5634 --------- Co-authored-by: Marya <111139605+MaryaBelanger@users.noreply.github.com>
1 parent 0e417c9 commit e9bbf96

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/content/language/methods.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,22 @@ class Point {
4141

4242
## Operators
4343

44-
Operators are instance methods with special names.
44+
Most operators are instance methods with special names.
4545
Dart allows you to define operators with the following names:
4646

47-
| | | | |
48-
|------|------|------|-------|
49-
| `<` | `+` | `\|` | `>>>` |
50-
| `>` | `/` | `^` | `[]` |
51-
| `<=` | `~/` | `&` | `[]=` |
52-
| `>=` | `*` | `<<` | `~` |
53-
| `-` | `%` | `>>` | `==` |
47+
| | | | | | |
48+
|-------|------|------|------|-------|------|
49+
| `<` | `>` | `<=` | `>=` | `==` | `~` |
50+
| `-` | `+` | `/` | `~/` | `*` | `%` |
51+
| `\|` | `ˆ` | `&` | `<<` | `>>>` | `>>` |
52+
| `[]=` | `[]` | | | | |
5453

5554
{:.table}
5655

5756
:::note
5857
You may have noticed that some [operators][], like `!=`, aren't in
59-
the list of names. That's because they're just syntactic sugar. For example,
60-
the expression `e1 != e2` is syntactic sugar for `!(e1 == e2)`.
58+
the list of names. These operators aren't instance methods.
59+
Their behavior is built in to Dart.
6160
:::
6261

6362
{%- comment %}
@@ -66,9 +65,10 @@ the expression `e1 != e2` is syntactic sugar for `!(e1 == e2)`.
6665
- `!` is probably excluded for historical reasons
6766
{% endcomment %}
6867

69-
An operator declaration is identified using the built-in identifier `operator`.
70-
The following example defines vector
71-
addition (`+`), subtraction (`-`), and equality (`==`):
68+
To declare an operator, use the built-in identifier
69+
`operator` then the operator you are defining.
70+
The following example defines vector addition (`+`), subtraction (`-`),
71+
and equality (`==`):
7272

7373
<?code-excerpt "misc/lib/language_tour/classes/vector.dart"?>
7474
```dart

0 commit comments

Comments
 (0)