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
In the user_begin_prompt function, if the user provides an invalid input (neither "A" nor "B"), the function recursively calls itself to re-prompt the user. This can lead to excessive recursive calls, especially if the user continues entering invalid inputs, potentially causing a stack overflow. This recursive approach is not ideal for user input validation and can be replaced with a more efficient loop.
Suggested Solution: Replace the recursive calls with a while loop that continues until a valid input is received. This way, the function won’t create new frames on the stack for each invalid input, avoiding possible performance issues.
The text was updated successfully, but these errors were encountered:
In the user_begin_prompt function, if the user provides an invalid input (neither "A" nor "B"), the function recursively calls itself to re-prompt the user. This can lead to excessive recursive calls, especially if the user continues entering invalid inputs, potentially causing a stack overflow. This recursive approach is not ideal for user input validation and can be replaced with a more efficient loop.
Suggested Solution: Replace the recursive calls with a while loop that continues until a valid input is received. This way, the function won’t create new frames on the stack for each invalid input, avoiding possible performance issues.
The text was updated successfully, but these errors were encountered: