Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8255] Correct and improve documentation for the % operator #50786

Closed
jepers opened this issue Jul 14, 2018 · 2 comments
Closed

[SR-8255] Correct and improve documentation for the % operator #50786

jepers opened this issue Jul 14, 2018 · 2 comments
Labels
improvement standard library Area: Standard library umbrella

Comments

@jepers
Copy link

jepers commented Jul 14, 2018

Previous ID SR-8255
Radar None
Original Reporter @jepers
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement
Assignee None
Priority Medium

md5: b54e8a4abfab2b08843f5e77b339e396

Issue Description:

It says "modulo operator" when it should be "remainder operator".
Details here: https://forums.swift.org/t/no-quick-help-for-operators-and-operator-incorrectly-documented/14440

Perhaps the documentation could also be clearer about how it works, and mention common pitfalls like:

extension BinaryInteger {
    var isOdd: Bool { return self % 2 == 1 }
}

for i in -3 ... 3 {
    print(i, i.isOdd ? "is odd" : "is even")
}
@jepers
Copy link
Author

jepers commented Jul 14, 2018

cc @stephentyrone @natecook1000

@stephentyrone
Copy link
Member

@natecook1000 addressed the biggest piece of this (the incorrect name) in #18013

@jepers do you want to keep this bug around for further improvement, or close it as done?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants