You are reading a single comment by @fanoush and its replies. Click here to read the full conversation.
  • output from the 2nd example is :

    nope
    >done
    >
    > 
    

    I expected that 'done' comes first. Because thats the behaviour of JS timeouts. But it output 'nope' which means the timeout callback is fired inbetween the while loop.

  • But it output 'nope' which means the timeout callback is fired inbetween the while loop.

    it is called after the while loop finishes. Each syntactically complete line is evaluated separately. And more so if you are just copy pasting it or sending it (which is done line by line too).

    Maybe if you would save it to flash and then restart, only then maybe it would fire after whole file from flash is done but maybe not even then.

    I am still a bit surprised why you would expect it to work like you suggest, that would be quite limiting.

About

Avatar for fanoush @fanoush started