You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: The code incorrectly calculates the number of days until Saturday by directly comparing time.Saturday with today + n. This causes errors when today + n exceeds 6 (the valid range for days of the week).
Steps to Reproduce:
Run the provided code.
The program may output incorrect results depending on the current day.
Expected Behavior: The program should correctly output:
"Today." if today is Saturday.
"Tomorrow." if tomorrow is Saturday.
"In two days." if Saturday is in two days.
"Too far away." if Saturday is more than two days away.
Actual Behavior: The code may produce incorrect outputs when today + n exceeds 6.
Context: https://go.dev/tour/flowcontrol/10
Description: The code incorrectly calculates the number of days until Saturday by directly comparing time.Saturday with today + n. This causes errors when today + n exceeds 6 (the valid range for days of the week).
Steps to Reproduce:
Expected Behavior: The program should correctly output:
Actual Behavior: The code may produce incorrect outputs when today + n exceeds 6.
Solution: Replace the comparison logic with:
The text was updated successfully, but these errors were encountered: