Closed wilsonwang371 closed 8 months ago
For example, you can use the attribute operator and union operation to do this.
mydict = {
key1 = "1"
key2= "2"
} | {
key = "value"
}
Or the unpack operator
mydict = {
key1 = "1"
key2= "2"
}
newDict = {
**mydict
key = "value"
}
See more documents here: https://kcl-lang.io/docs/user_docs/support/faq-kcl#4-how-to-add-elements-to-a-dict
Additionally, thank you very much for opening the issue for discussion. We will regularly synchronize user questions to the FAQ document.
General Question
How do i add a key and value to existing dict in kcl?
For example: I want to be able to do something like this in kcl