Announcement

Collapse
No announcement yet.

Unexpected behavior with Repeat-Until function

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unexpected behavior with Repeat-Until function

    Hello 4D Systems support,

    I'm having a weird problem with the Repeat-Until function. The loop repeats as expected and ends as expected, but then goes back into the loop somehow. Here is the code:

    Code:
        if(errorFlash == 1 && status == 1)
            img_Disable(hndl, -1);
    
            repeat
                if(sys_GetTimer(TIMER7) == 0 && errorFlash == 1)
                    if(errorToneCounter < 8)
                        error_sound();
                        errorToneCounter++;
                    else if(errorToneCounter > 30)
                        errorToneCounter := 0;
                    else
                        errorToneCounter++;
                    endif
    
                    error_flash();
    
                    sys_SetTimer(TIMER7, errorSoundDelay);
                endif
            until(touch_Get(TOUCH_STATUS) == TOUCH_PRESSED);
    
            errorFlash == 0;
    
            display_main_screen();
    
        endif
    After the screen is touched, display_main_screen() is called as expected, but then error_flash() gets called again in less than a second and the looping starts again. I was hoping someone might have an idea why this phenomenon could be happening. Did I misuse the Repeat-Until function? Any advice would be greatly appreciated. Thank you!

  • #2
    In 4DGL code, to equate or assign a value to a variable you must use the := operator

    errorFlash := 0;

    Comment


    • #3
      Ah! Embarrassing... Sometimes you just need an extra set of eyes on it. Thank you!

      Comment

      Working...
      X