Scala3 Vlog: Union Types

Table of contents
Reading Time: < 1 minute

Hello folks,

We have released another video on Scala3 series which talks about a new type i.e. Union Types.

Union Type is a type which is one of a set of other type, or a type of a variable or expression which can consist of multiple types. And the main reason for introducing Union Types in Scala is that for every set of types, we can always form a finite LUB.

A Type A | B | C is a Union Type which has all the values of type A, type B and type C.

Union Types are commutative by nature. This means that A | B is same type as B | A.

Watch out the video to get more details on it.

Knoldus-blog-footer-image

Written by 

Harshit Daga is a Sr. Software Consultant having experience of more than 4 years. He is passionate about Scala development and has worked on the complete range of Scala Ecosystem. He is a quick learner & curious to learn new technologies. He is responsible and a good team player. He has a good understanding of building a reactive application and has worked on various Lightbend technologies like Scala, Akka, Play framework, Lagom, etc.