‎2022 Sep 07 6:20 PM
From an Input let's say '3' i want to display a product of that input from 1 to 10, but i want to skip the 5th iterration.
I made two loop and i would like to know if there is one that is better than an other in term of optimisation...
And yes i have already declare all variables and parameters.
Thanks
Loop1
WHILE v_y <= 10 . " Loop the into the v_y until it is equal 10
IF v_y <> 5 . " We check if v_y is different than 5
v_res = p_x * v_y .
WRITE :/ p_x,'*',v_y,'=',v_res .
ELSE. " If v_y = 5 we skip and we do nothing
ENDIF .
v_y = v_y + 1 . " We increment the v_y to go to the next number
ENDWHILE .
Loop 2
WHILE v_y <= 10 . " Loop the mutiply until variable equal 10
IF v_y = 5 . " We check if v_y is different than 5
v_y = v_y + 1 . "We increment the v_y
CONTINUE.
ENDIF.
v_res = p_x * v_y .
WRITE :/ p_x,'*',v_y,'=',v_res .
v_y = v_y + 1 . " We increment the v_y to go to the next number
ENDWHILE .
‎2022 Sep 07 7:16 PM
You should not waste time in optimizing few microseconds... Focus on expensive constructs only.
‎2022 Sep 07 10:20 PM
thank you sandra.rossi ,
what are you calling expensive construts ?
‎2022 Sep 08 8:31 AM