Concept Flow - Union type syntax and behavior
Declare variable with union type
Assign value of first type
→Check if value matches type
| Yes
Use value safely
Assign value of second type
→Check if value matches type
| Yes
Use value safely
Assign value of other type
→Type error, stop
A variable can hold values of multiple types declared with a union. Assignments are checked against these types, allowing only matching types.