5 Replies Latest reply: Mar 13, 2018 2:44 AM by Oleg Savinkov RSS

    Do While ...Loop continued working after the condition became invalid

    Oleg Savinkov

      Hello!

      I write some code as

       

      set FirstYear=2016;

      Let CurrentYear = Year(Today()); //2018

      ......

      DO while $(FirstYear)  <= $(CurrentYear)

                   $(vTable)__c_Final:

                                    SQL SELECT  *

                                     FROM

                                     $(vTable)  Where CreatedDate>= $(FirstYear)-01-01T00:00:00.000+0000 and CreatedDate<= $(FirstYear)-12-31T00:00:00.000+0000;

                                       Let  FirstYear = $(FirstYear)+1;

                                       DROP $(vTable)_Final

                                        SLEEP 1000;

      LOOP

      ....

      This code started working and continued working after the condition became invalid! It works with FirstYear = 2016 (true), 2017 (true), 2018(true), 2019 ( false!!) and so on. And when I debug it I don't see "Do.." string in debug cycle. When I write condition in 'LOOP' string, cycle works true:

       

      DO...

      LOOP  while $(FirstYear)  <= $(CurrentYear)

       

      works true.

       

      Could you please tell me why cycle does not   work in first case?