Skip to content
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
2 changes: 1 addition & 1 deletion src/content/docs/getting-started/hello-world.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ purus run hello.purus
```purus
const x be 42
let y be 3.14
y be 100
y add be 1 -- y += 1 (compound assignment)
```

## Functions
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ja/getting-started/hello-world.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ purus run hello.purus
```purus
const x be 42
let y be 3.14
y be 100
y add be 1 -- y += 1(複合代入)
```

## 関数
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/ja/reference/control-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ for (const item of list) {

```purus
while i lt 10
i be i add 1
i add be 1

until finished
do-work[]
```

```js
while (i < 10) {
i = i + 1;
i += 1;
}
while (!(finished)) {
do_work();
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/ja/reference/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ fn count-up limit
let i be 0
while i lt limit
yield i
i be i add 1
i add be 1
```

```js
function* countUp(limit) {
let i = 0;
while (i < limit) {
yield i;
i = i + 1;
i += 1;
}
}
```
Expand Down
5 changes: 4 additions & 1 deletion src/content/docs/ja/reference/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ data.method(arg)
```purus
const x be 42
let y be 10
y be 20
```

:::caution
裸の識別子への再代入(`y be 20`)は**コンパイルエラー**です([構文の概要](/ja/reference/syntax/)参照)。プロパティ・インデックス(`obj.x be 1`、`arr[\0] be 1`)と分割代入(`[a; b] be [b; a]`)は宣言キーワードなしで代入でき、可変の変数の更新には複合代入(`y add be 10`)を使います。
:::

## 複合代入

算術演算と代入を組み合わせた複合代入演算子:
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/reference/control-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ for (const item of list) {

```purus
while i lt 10
i be i add 1
i add be 1

until finished
do-work[]
```

```js
while (i < 10) {
i = i + 1;
i += 1;
}
while (!(finished)) {
do_work();
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/reference/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ fn count-up limit
let i be 0
while i lt limit
yield i
i be i add 1
i add be 1
```

```js
function* countUp(limit) {
let i = 0;
while (i < limit) {
yield i;
i = i + 1;
i += 1;
}
}
```
Expand Down
5 changes: 4 additions & 1 deletion src/content/docs/reference/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ data.method(arg)
```purus
const x be 42
let y be 10
y be 20
```

:::caution
Reassigning a bare identifier (`y be 20`) is a **compile error** — see [Syntax Overview](/reference/syntax/). Property and index targets (`obj.x be 1`, `arr[\0] be 1`) and destructuring (`[a; b] be [b; a]`) assign without a declaration keyword, and mutable variables are updated with compound assignment (`y add be 10`).
:::

## Compound Assignment

Compound assignment operators combine an arithmetic operation with assignment:
Expand Down
Loading