|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching * Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
SequencesA sequence is a dynamic array. Same thing as a list in Python. Sequences are stored on the heap, thus they are garbage collected.
When you simply write In the Nim code, var nums = @[] # ERROR: cannot infer the type 𝥶It doesn't work because the compiler cannot figure out the type of the sequence. var nums = @[1, 2, 3] # OK 𝥶It's OK, var numbers1: seq[int] 𝥶Here we declare a sequence of integers. Nim will initialize it, thus it becomes an empty sequence. echo numbers1.len 𝥶This if UFCS. It's actually transformed to |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |
||||