Add enum value in runtime? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Add enum value in runtime?

Ex: enum Weapons {Knife, Gun, Grenade}; Then, i want to add Bazooka to it, so that Weapons.Bazooka is valid. Is it possible?

26th Dec 2021, 12:52 AM
Early - avatar
2 Answers
+ 2
Just add it to the enum if you know you want to use Bazooka.
26th Dec 2021, 2:06 AM
Brian - avatar