- Jan 19, 2020
- 12,382
- 48,872
Well... kind of, yes. Basically one (regardless of coding language) declares (defines) all variables at project initialization... the "base" of the variable's state (doesn't matter if it's integer, boolean, text, etc... it's the same principle). Once the actual coding is executed past initialization then one sets the variables as needed (they've already been declared). Then the rest of the code operates based on the variable setting (which can change of course).I'm guessing the biggest problem with this, other than convention, is that those variables can never have a default state to return to?
So, you are likely thinking correctly tbh. For example one might have a variable that will be later used to reference an LI's relationship condition. So, we would declare something like "define li_relp = 0", so that the baseline (default) is nothing... no relationship. Then, as the story (in the case of the code being an AVN) we would set it to be something different on an as needed basis. One would NEVER use a conditional to define (declare) variables that I can think of. I've never seen it myself ever, and never seen any language documentation that would state otherwise.
So, that's basically the nitty-gritty summarized in layman's terms... if that makes sense. Bottom line: declaring (defining.. same thing) variables is VERY different that setting variables. Variables must be defined as one base then later set as needed.... never defined willy-nilly based on conditionals (again, that I've every seen or read).
Again, I'd love to be schooled where I'm incorrect (I'm all for learning new shit)... in any coding language (it's not specific to Python but all languages).