The Whiley programming language uses union types as a way of combining types together. Here’s a simple example to illustrate:
function indexOf(string str, char c) => null|int: for i in 0..|str|: if str[i] == c: return i // found a match // didn’t find a match return null
Here, the type null|int is a . . . → Read More: Understanding why Union Types are useful