|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching * Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
Defining type for anonymous tuplesLet'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 |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |