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 ]

Grouping the input parameters

Consider this snippet:

func add(a: int, b: int): int =
  a + b

echo add(2, 3)  # 5

Since the input parameters have the same type, they can be grouped:

func add(a, b: int): int =
  a + b

echo add(2, 3)  # 5

Now both a and b have the same type (int).

How to add another group?

Groups are separated with a ';' (semicolon) on the formal parameter list:

func add(a, b: int; msg: string): int =
  a + b

echo add(2, 3, "add two numbers")  # 5

Actually, it would also work with a ',' (comma) instead of the semicolon. However, I find that harder to read.

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 04, 10:42