im new to Solidity.
I was wondering if it is possible to do something like this in Solidity using enum.
enum Menu {
Burger,
Pizza,
Fries
}
uint price; // storing different prices of different items here
// Assuming that the var userMenu contains the user's selected value from Menu enum
if (userMenu == Menu.Burger) {
price = 2;
} else if (userMenu == Menu.Pizza){
price = 4;
} else if (userMenu == Menu.Fries) {
price = 1;
}
I know that the initialization of values into price can be done more efficiently. I just want to know if there are any methods to do something like this. Thanks!