Skip to content

Item #29: typo/wrong operator ? (should be <= instead) #129

@danqzq

Description

@danqzq

Describe the mistake

In common mistake 29 "Comparing values incorrectly", the note states:

Line 545 in index.md:

We can also use the `?`, `>=`, `<`, and `>` operators with numeric types to compare values and with strings to compare their lexical order.

The ? operator does not exist in Go. This appears to be a typo for <= (less than or equal), which would complete the standard set of comparison operators alongside >=, < and >.

Solution

Fix the note with correct operator usage:

We can also use the `<=`, `>=`, `<`, and `>` operators with numeric types to compare values and with strings to compare their lexical order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    community mistakeMistakes proposed by the community

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions