Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* 2025/26/2
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Nim2
* Scala


[ edit | logout ]
[ sandbox | passwd ]

for loop on an ASCII string

The Nim method here will only work with ASCII strings. If you have a Unicode text, then we'll need a different approach.

(1) access just the characters
s = "Laci"

for c in s:
    print(c)
let s = "Laci"

for c in s:
  echo c

Output:

L
a
c
i
(2) access the characters AND the indexes
s = "Laci"

for idx, c in enumerate(s):
    print(f"{idx}: {c}")
import std/strformat

let s = "Laci"

for idx, c in s:
  echo &"{idx}: {c}"

Output:

0: L
1: a
2: c
3: i
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2026 April 05, 23:47