Once again i broke something

I am trying to figure out how to fix this error but
I can find anything wrongbut maybe I am blind

Link to my repl

here is a screenshot of my repl

how do i keep breaking my code
it is just inevitible i guess

the variable same is lost when you leave the for loop. I think lines 15 and 16 are not meant to be there

4 Likes

It’s truly inevitable to work without making any error, cause we can’t be perfect. Whenever we make errors, language itself tells us what error it is.

For example in this case it said that you referenced(used) the variable before assigning it(declaring it).

So we just need to read the error and interprete its meaning. If you’re ever confuse with what is meant by a particular error, you could do some experiments, google it and of course feel free to share it here :grinning:.

This is not an answer but just an explanation to help you through such problems in future. P.S. you should really check out debugging and error handling.

1 Like

ok thanks @Pro0grammer and @StupidGenius