❔ When setting up menus would you guys say the "If" method or Switch is more suitable?
Which would be the best option?
13 Replies
As in... choosing between selection options with an if vs a switch statement?
Who cares. For a few options, use if, switch, ... doesn't matter. For many options, you'd likely want to use a switch, just because it's a tiny bit more concise and usually explains intent of mutually exclusive selections better
spectre.console ¯\_(ツ)_/¯
Thanks for the replies friendos. 🙂
im doing a questionnaire and its been messing me up with these kinds of silly questions
If you're using an IDE, you don't even need to worry about these
Many of these conversions have been automated for you
oooooh
thanks 😮
okay so this might be hard to explain
butttttttttttttt
this is a diagram of a program that's purpose is;
Start
Write Logs - choose a menu - quit program
write a new statement in log - Search for statements within log
read title - read search
read text - save input
or if the search exists within log - if true - write and present result
if false go back to menu
Question is, what kind of loop is best suited for this purpose?
while (true)
always
Thanks a ton 😄 and for the patience
I'd not implement this as a single menu, but rather a main menu that triggers another method that contains sub-menus as needed
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.