Variable doesn't exist even though it does
-
Variables in my project are being told that they dont exist I need help.
-
Are your variables only inside functions, conditionals, or loops?
If so they only exist inside those functions, conditionals and loops and nowhere else.Are you attempting to access a global variable from inside a conditional or loop that's nested under several other conditionals or loops?
I've found you can only go about 4 deep and then it can no longer see the global variable from inside the nested conditional or loop. -
@Jongjungbu said in Variable doesn't exist even though it does:
I've found you can only go about 4 deep and then it can no longer see the global variable from inside the nested conditional or loop.
Wow, really? Good info! Do you know it this include multiple levels of nested function calls as well?
-
@Nisse5 Oh haven't tried nested function calls beyond 2, so I don't know. Worth investigating!
-
@Jongjungbu It might be interesting to try out with recursion.
-
I encountered a similar issue just now, where some (2 out of 4) of the member names in a struct was lost when the structure was passed to a function (I printed the content of the struct to verify, and 2 of the members had become something like ". = 43"). I was able to work around it by not calling the function and handle it in the caller instead.
Will try to create some reproducible code later...