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 ]

Defining type for anonymous tuples

Let's go back to this example:

func getMovieInfo(): (string, int, float) =
  return ("Total Recall", 1990, 7.5)

let (title, year, score) = getMovieInfo()

echo title    # Total Recall
echo year     # 1990
echo score    # 7.5

𝥶If you want to return multiple values from a function, this is perfectly fine.

However, if you want, you can define a type for it:

type
  Movie = (string, int, float)

func getMovieInfo(): Movie =
  return ("Total Recall", 1990, 7.5)

let (title, year, score) = getMovieInfo()

echo title    # Total Recall
echo year     # 1990
echo score    # 7.5
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 09, 08:45