|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching * Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
Declaring variablesNim is a statically typed language, meaning that the type of every variable is known and checked at compile time, rather than at runtime. However, Nim has some nice quality of life features, like type inference for instance. Once the type of a variable is determined, it cannot change in the future. var vs letIn Python there are mutable (ex.: list, set) and immutable (ex.: string, tuple) data structures. In Nim mutability/immutability depends on how the variable was declared.
var a = 2 # type is inferred to int var b: int = 10 # type is specified explicitly a += 1 echo a # 3
let a = 2 # type is inferred to int let b: int = 10 # explicit type a += 1 # error constIt's similar to We use A typical use case for
Here is a longer example for |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |
||||