+ 1
I'm a beginner. How am I doing?
I'm practicing and I made a calculator but I think it is a WET code. What do you think about this code? How can I make it shorter and more efficient? https://code.sololearn.com/cLIC65RbW8XW/?ref=app
1 Réponse
+ 4
Yes, it is very wet. ☺️
You should start using functions, for everything. Imperative programming is the past.
Look at the parts of your code that you repeat multiple times, and try to extract them to separate functions. Like printing the menu or asking for input. If there is a small change in any of those parts, consider using parameters to control which "version" of the function to run.