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

Add programming docs #487

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions programming/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Programming

Docs on programming topics
23 changes: 23 additions & 0 deletions programming/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"uuid": "1a737701-e2f7-4021-9057-a0faf4738740",
"slug": "APEX",
"path": "programming/README.md",
"title": "Programming docs",
"blurb": "Docs on programming topics"
},
{
"uuid": "54390764-ef34-4385-b714-ab2851bdd814",
"slug": "reaminder",
"path": "programming/operators/README.md",
"title": "Operators",
"blurb": "Docs on operators"
},
{
"uuid": "f1848a5a-593d-411f-9d44-4d4849690e1e",
"slug": "remainder",
"path": "programming/operators/remainder.md",
"title": "Remainder",
"blurb": "The remainder operators"
},
]
3 changes: 3 additions & 0 deletions programming/operators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Operators

Docs on operators
30 changes: 30 additions & 0 deletions programming/operators/remainder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Remainder

In mathematics, the **remainder** is the amount "left over" after performing some computation.
For example, the remainder of `5 / 3` is `2`.

Many programming languages use the percentage sign (`%`) as an operator to calculate the remainder.
For example, this is valid code in Javascript and Python:
```javascript
5 % 3 == 2
```

Remainders can often be calculated on both integers and floating point numbers.
For example,
```javascript
5.3 % 3 == 2.3
```

When working with negative numbers, the result always has the same sign as the dividend (the number on the left hand side that is being divided).
For example:
```javascript
-5 % 3 == -2
5 % -3 == 2
-5 % -3 == -2
```

Some languages use the `%` operator for the calculating the modulus, not the remainder.
This treats negative numbers differently.
You can learn more about this [on Wikipedia](https://en.wikipedia.org/wiki/Modulo).