Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/How to add strings in Type ENUMForum ↗

How to add strings in Type ENUM

App Development2 posts293 views1 likesLast activity Feb 2022
NI
nikhilreddyOP
Feb 2022

I wanted to add strings in type ENUm. How can I do that?

CO
cocreature
Feb 2022

Hi @nikhilreddy, could you provide an example of what you are trying to acheve?

In Daml, an enum is a variant where all constructors have no arguments, e.g.,

data X = A | B

Given that the cannot have arguments you cannot store strings in there. However, you can use a variant instead which can have arguments

data X = A Text | B Text
← Back to Discussions