Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Debugging of undefined vars in break if statements

edited January 2017 in OpenSesame

Hi,

I just encountered the following situation: I was trying to break a loop item with the "break if" option. I used a conditional statement to check the count of variable A and break the loop if var A would be equal var B. It just did not break the loop and I had no idea why.
It turned out, that I did not define variable A which made OpenSesame to skip the entire block iteration instead of raising an error or giving me a warning. Without going into too much detail of my situation, there are plenty of situations in which I believe this way of handling such a mistake can make debugging very very difficult.
I wonder whether it would be better if OpenSesame gives in such a case a warning in the debug window or - even better - raises a python error.

Michel

Comments

  • Hi Michel,

    If you haven't defined a variable whilst trying to call it in a break-if or run-if statement, the experiment should definitely not run and you should get an error message that states that your variable does not exist.
    It seems that something in your experiment caused it to skip the entire block, so that the break-if statement never came into the picture in the first place. Just as a test, you could for example insert the break-if statement [just_testing] = 99, both in your original block as well as in a new block placed right at the start of your experiment. The former may not cause an error (because you're skipping the block entirely for some reason) while the latter definitely will.

    Cheers

    Josh

  • Hey Josh,

    It should not, but it does skip the block and does not raise an error. I've made a toy example of what I mean. The break if condition is in the block loop item and it is a variable that is not defined earlier (or anywhere else for that matter). Running it does not raise an error but simply skips the block (i.e. feedback display inside the block loop sequence is not displayed).
    I think it would be more intuitive and less error prone if this would raise an error!

    Michel

    PS: I ran this with the most recent OS version.

Sign In or Register to comment.