lunduniversity / introprog

Teaching material for "Introduction to Programming using Scala" at Lund University, LTH. http://cs.lth.se/pgk/
142 stars 171 forks source link

(4.2.1) - Quiz w04 - Task 1 #665

Closed valterbergstrand closed 1 year ago

valterbergstrand commented 1 year ago

Type alias is mentioned in Task 1, but the terminology is not explained during the chapter. Maybe add a short description. Something similar to:

"Nyckelordet type används för att skapa en referering till en annan datatyp. Kan användas för att skapa en förkortning av en datatyp med annars längre syntax, som exempelvis när man specificerar vilken elementen i en Array ska ha: 'Array[Char]'"

scala> type Bokstäver = Array[Char] // definerar Bokstäver som en type alias till Array[Char]

scala> val Ord: Bokstäver = Array('a', 'b', 'c') val Ord: Bokstäver = Array(a, b, c)

bjornregnell commented 1 year ago

Yes, good catch! Yes there should be a slide on type aliases in week 4.

bjornregnell commented 1 year ago

I will move the slide from week 7 on type aliases to week 4.

bjornregnell commented 1 year ago

Screenshot from 2022-09-21 12-50-36