https://www.boundaryml.com logo
🟡 Can an enum have a null value?
# questions
r
Can an enum have a null value?
g
Nope! Type error. But
MyEnum | null
can.
I might be misunderstanding your question though. BAML has a builtin value called
null
which can not be assigned to any Enum. However, you can define an enum with a variant that serves the purpose of
null
.
r
I defined an
UNK
Enum value that I assign if nothing else makes sense. This addressed the issue, the description says to do so.