frostyelk wrote:... Mostly because there is no need for an Else when you have a condition like yours...
I actually put that extra condition because i had some strange behavior. With the extra condition, I wasn't getting any issues.
codah wrote:Couple of things. You have a local variable which will be reset immediately (i.e. next tick).....
Ah yes, thanks, was a bit tired when I made this post, it was supposed to be static variable, I don't think it should have effected this though. Just to be clear, when running the "Toggle.." function, the "WriteToLog" function seemed to have been called twice, which made me wonder if there could be a reason for this.
codah wrote:... Plus we can't see other things, like how you are calling the functions, the log messages themselves, etc.
edit: not to mention you don't need 2 functions to do this, unless this is just experimenting
Yea, I think i was not clear enough in explaining the problem, the issue seemed very much to happen in the same function call. I was asking here about the else statement to be sure the else in construct functions the way I expect it too. My codebase has become quite large and I'm trying to be sure about how things work, before digging through it.
Sometimes having 2 functions makes code clearer to read and easier to return to
I should probably not call it toggle though if it has 2 functions...
Kyatric wrote:In the absolute, Else is supposed to indeed be executed if and only if the previous event hasn't been executed, like in a regular if/else statement in any other coding language.