Do we need the else statemet if we do not change any variable?
In the solution the else statement does not modify the variable
is it needed or can we omit it?
1 answers ( 0 marked as helpful)
Thanks for reaching out.
Yes, this exercise could be solved without these two lines of code, that's right. However, best practices require to leave code that is visible for other readers what will happen to the base value in case the if statement has not been satisfied. Hence, the version we've left as a solution to our exercise.
Hope this helps.
Submit an answer
Resolved: The attached files to this video are getting downloaded in unknown format, any help???
Resolved: Exam Question. Question No: 24. Not totally correct option and explanation.