Variants (tweet) #4809
ggreif
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motoko has a neat feature where a datatype can have exactly one choice of many, and can also carry specific data. These are called variants and generalise other languages' enumerations.
You can (usually) figure which case you have at hand by performing a pattern match
example TBW
Beta Was this translation helpful? Give feedback.
All reactions