+ 2

A very weird error on my project

So, I was coding a rock paper scissors game, then when I test it, it says there is an error "maximum call stack size exceeded" the console says, if you know the fix and WHY this error even exists, please leave a comment! https://code.sololearn.com/W23U9Uan2saE/?ref=app

27th Sep 2022, 3:43 AM
RayZ - avatar
5 Answers
+ 3
Line 13: please rename your function prompt to myprompt( or as you want) Otherwise in line 14 you call it what leads to an infinite recursive call.
27th Sep 2022, 4:18 AM
Oma Falk
Oma Falk - avatar
+ 5
your myprompt() function is working by itself, i.e. it takes the user input value and stores it, you didn't detailed what to do with this data later, you could have included your rest of the block code on it.
27th Sep 2022, 5:26 AM
Félix Zamdamela
Félix  Zamdamela - avatar
+ 2
Oma Falk Thank you! It worked. Never thought a function name could summon such error.
27th Sep 2022, 4:30 AM
RayZ - avatar
+ 1
Emerson Prado Félix Zamdamela now I understand, the problem occurs because the compiler doesn't know what function to execute, the prompt function I made, or the prompt function that is built in, thank you!
3rd Oct 2022, 3:03 AM
RayZ - avatar
RayZ All names should be unique in their scope
28th Sep 2022, 3:52 AM
Emerson Prado
Emerson Prado - avatar