Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

* Scripting Languages
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* aktuális (2023/24/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
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Nim /

20180617f

read from stdin using a module

Let's put the following in a module called py.nim:

# py.nim

proc input*(text: string = ""): string =
  stdout.write(text)
  stdin.readLine()

The * at the end of a function's name means that the function is exported, i.e. if someone imports this module, the starred functions are visible (and thus usable).

How to use an own module?

import py


let name = input("Your name: ")
echo "Hello ", name, "!"

Output:

Your name: Lac
Hello Lac!
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 2018 June 17, 11:43