Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ cmake --build build

```bash
ry <file.ry> # Run a Ry script
echo '<code>' | ry # Run code from stdin
echo '<code>' | ry -c # Run code from stdin
ry test [options] [path] # Run tests (*.test.ry)
ry init # Initialize a project in current directory
ry new <name> # Create a new project
Expand All @@ -134,7 +134,7 @@ The `self-update` command verifies release artifacts using Ed25519 signature ver
Stdin also supports here-documents:

```bash
ry <<'RY'
ry -c <<'RY'
a = 1
b = 2
print(a + b)
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ For detailed language specifications, see the reference pages below.
| [Math Functions](reference/math.md) | PI, E, sqrt, sin, cos, abs, floor, ceil, round, etc. |
| [I/O Functions](reference/io.md) | read_text, write_text, exists, read_bytes, to_bytes, etc. |
| [JSON](reference/json.md) | parse, stringify, get, at, to_str, to_int, etc. |
| [Network (TCP)](reference/net.md) | bind, listen, accept, connect, send/recv/close for TCP sockets |
| [Network (TCP)](reference/net.md) | bind, listen, accept, connect, send/receive/close for TCP sockets |
| [HTTP Server](reference/http.md) | listen, method, path, header, body, response |
| [Base64](reference/base64.md) | encode, decode, encode_url_safe, decode_url_safe |
| [Path](reference/path.md) | join, basename, dirname, extension, resolve, is_absolute |
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```bash
ry <file.ry> [args...] # Run a Ry script
echo '<code>' | ry # Run code from stdin
echo '<code>' | ry -c # Run code from stdin
ry test [options] [<file> | <dir>] # Run tests
ry init # Initialize a project
ry new <project-name> # Create a new project
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/03-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| `-` | Subtraction | `3 - 2` | `1` |
| `*` | Multiplication / string repetition | `3 * 2` | `6` |
| `/` | Division (always float) | `7 / 2` | `3.5` |
| `//` | Floor division (int for int operands, float if either is float) | `7 // 2` | `3` |
| `//` | Floor division (always int) | `7 // 2` | `3` |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
| `%` | Modulo | `7 % 3` | `1` |
| `**` | Exponentiation (always float) | `2 ** 10` | `1024` |
Comment thread
t0k0sh1 marked this conversation as resolved.

Expand All @@ -28,7 +28,7 @@ print(a * b) # 30
print(a / b) # 3.3333... (float)
print(a // b) # 3 (int)
print(a % b) # 1
print(2 ** 8) # 256 (float)
print(2 ** 8) # 256
```

> **Overflow safety:** Arithmetic on `int` (`+`, `-`, `*`, unary `-`) raises a runtime error if the result overflows the 64-bit signed range. Constant expressions that overflow are caught at compile time. Low-level types (`i32`, `u8`, etc.) wrap silently — use `checked_add`/`saturating_add`/`wrapping_add` for explicit overflow control.
Expand Down Expand Up @@ -184,8 +184,8 @@ print(4 / 2) # 2 (float)
print(7 // 2) # 3 (int)
print(7.0 // 2) # 3 (int)

# ** always produces float
print(2 ** 3) # 8 (float)
# ** produces int for int operands
print(2 ** 3) # 8
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

# % produces int if both operands are int, float if either is float
print(7 % 3) # 1 (int)
Expand Down
Loading