adambard / adambard/learnxinyminutes-docs

[language/nim] confusing comment about immutable at the very start

Ouverte
#4,981 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Markdown
Étoiles
12.3k
Forks
3.7k
Merge moyen
13 h 10 min
PR mergées (30 j)
6

Description

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
```
?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
nim
Domaine
documentation
Type d'issue
Documentation
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.