I have a student asking why the answer is School day. I would appreciate help with an explanation that they will understand.
- day_of_week is first assigned a value of “Saturday”.
- Next statement replaced that value with “Monday”. The value “Saturday” is garbaged!
- So now, since the day_of_week is neither “Saturday” nor “Sunday”, the if condition is false.
- The else part is executed, function weekday is called which displays “School day”.
Thank you so much! This is exactly my thinking but i guess my brain was on overload because I just couldn’t put it to words! I appreciate your help.