adambard / adambard/learnxinyminutes-docs
[language/nim] confusing comment about immutable at the very start
- 主要语言
- Markdown
- 星标
- 12.3k
- 派生
- 3.7k
- 平均合并
- 13 小时 10 分钟
- 30 天内合并 PR
- 6
描述
https://learnxinyminutes.com/docs/nim/
```nim
var # Declare (and assign) variables,
letter: char = 'n' # with or without type annotations
let # Use let to declare and bind variables *once*.
legs = 400 # legs is immutable.
const # Constants are computed at compile time. This provides
debug = true # performance and is useful in compile time expressions.
```
it's very unclear to me as a complete ignorant about the language (but not ignorant about many others) what let is vs const?
to me immutable literal is no different than a constant, what am I missing? (and/or how is it different from var ?)
maybe a better example would be
```nim
let
legs = someFunction()
const
clegs = 42
```
?
贡献指南
调研方向
Start with the Nim page at https://learnxinyminutes.com/docs/nim/ and review the opening var, let, and const example. Check Nim's distinctions between mutable variables, immutable bindings, and compile-time constants, then clarify the surrounding comments or example. Done means a newcomer can understand how let differs from const and var from this section alone.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- nim
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100