Concept Flow - Union types in practice
Function with Union Type Parameter
Call function with int
→Accept int
Call function with string
→Accept string
Call function with other type
→Error: Type Mismatch
Function returns value
The function accepts either int or string as input. It checks the type and processes accordingly. If input is not int or string, it causes a type error.
