docs: Fix peek/match documentation inconsistencies
- Update CLAUDE.md: peek式 → match式, peek構文 → match構文 - Update LANGUAGE_REFERENCE_2025.md: Peek式 → Match式 - Fix default pattern: else → _ (underscore) - Resolve confusion causing JSON development Claude to use incorrect syntax This fixes the root cause where new AI developers were referencing outdated 'peek' syntax examples and getting parse errors, forcing them to rewrite with 'if' statements instead of using the correct 'match' syntax. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -196,14 +196,14 @@ loop() { } # 無条件ループは `loop(true){}` を意図明確
|
||||
> 設計メモ: Nyashは「単一入口・先頭条件」の制御フロー規律を重視するため、do‑whileは採用しません。必ず実行の表現は `loop(1)` ラッパーや `repeat/until` 糖衣からゼロコストで正規化します。
|
||||
```
|
||||
|
||||
#### **Peek式(Phase 12.7で追加)**
|
||||
#### **Match式(Phase 12.7で追加)**
|
||||
```nyash
|
||||
# パターンマッチング風の分岐
|
||||
local result = match value {
|
||||
"A" => 100,
|
||||
"B" => 200,
|
||||
"C" => 300,
|
||||
else => 0 # else必須
|
||||
_ => 0 # _はデフォルトパターン
|
||||
}
|
||||
|
||||
# 文の形式も可
|
||||
@ -215,7 +215,7 @@ match status {
|
||||
"success" => {
|
||||
print("All good")
|
||||
},
|
||||
else => {
|
||||
_ => {
|
||||
print("Unknown status")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user