Crystal Medium · Lesson 4

Union types and flow typing

Work with values that can be more than one type: narrow with is_a?, case and if var, cast with as and as?, and copy instance variables before narrowing.

Lessons · Crystal Medium · Lesson 4 of 10

Union types and flow typing

Work with values that can be more than one type: narrow with is_a?, case and if var, cast with as and as?, and copy instance variables before narrowing.

Illustration for Crystal
Work with values that can be more than one type: narrow with is_a?, case and if var, cast with as and as?, and copy instance variables before narrowing.