Use an option or enum variable when using StrMenu #498
rvanbekkum
started this conversation in
Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Maybe this is more something for ALGuideLines.dev or BCQuality, but I'll post it here first and see your thoughts on this.
This is probably something for
FormattingCopas it concerns code readability, or maybe evenLinterCopas it can also prevent mistakes and improve extensibility.When you use the
StrMenumethod, it is good to use anOption(or maybe even anEnumvariable if you want it extensible), e.g.:The
StrMenuExample2_Optionis the sweet spot, especially when extensibility (adding new options) is not required for the scenario.It is already much more readable then
case StrMenu(..) of 1: ...; it makes the intent much more obvious.All reactions