8000 Merge pull request #51 from cyung/patch-2 · sync2003/swift-style-guide@71a1c1a · GitHub
[go: up one dir, main page]

Skip to content

Commit 71a1c1a

Browse files
author
niwatako
committed
Merge pull request github#51 from cyung/patch-2
Clarify grammar regarding let binding
2 parents 8d09199 + 899a75e commit 71a1c1a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Use `let foo = …` over `var foo = …` wherever possible (and when in doubt).
2828

2929
_Rationale:_ The intent and meaning of both keywords is clear, but *let-by-default* results in safer and clearer code.
3030

31-
A `let`-binding guarantees and *clearly signals to the programmer* that its value is supposed to and will never change. Subsequent code can thus make stronger assumptions about its usage.
31+
A `let`-binding guarantees and *clearly signals to the programmer* that its value will never change. Subsequent code can thus make stronger assumptions about its usage.
3232

3333
It becomes easier to reason about code. Had you used `var` while still making the assumption that the value never changed, you would have to manually check that.
3434

README_JP.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ Swift コーディング規約
2828

2929
_理由:_ 二つのキーワードの意図と意味は明瞭ですが、*デフォルトでlet*を使うことは、より安全でより明確なコードになります。
3030

31-
`let`宣言は、その変数の値が変わらないとを想定されていて、かつ実際に変わらない
32-
ことを保証すると同時に、それを*プログラマに明確に伝えます*。そのため、その後に続くコードにおいて、その変数の用途を推測しやすくなります。
31+
`let`宣言は、その変数の値が変わらないことを保証すると同時に、それを*プログラマに明確に伝えます*。そのため、その後に続くコードにおいて、その変数の用途を推測しやすくなります。
3332

3433
コードを論理的に理解するのがより簡単になります。値が決して変わらないと考えているにもかかわらず`var`を使うと、本当に値が変わらないかどうかを手動でチェックしなければいけません。
3534

0 commit comments

Comments
 (0)
0