PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK

  • Reason
  • Correction
  • Examples
  • Using an integer in the counter of the loop and a real in the STEP of the loop
Products
WINDEVWEBDEV - Server codeWEBDEV - Browser codeWINDEV MobileReports and Queries
Platforms
WindowsLinuxWindows MobileUniversal Windows 10 AppAndroidAndroid Widget iPhone/iPadApple Watch
Languages
JavaPHPAjaxUser code (UMC)External language
Databases
HFSQLHFSQL Client/ServerStored proceduresOLE DBODBCNative Accesses
Error 20: The variable of the FOR loop should be a real
Reason
You are using a loop statement (FOR). In this statement, you are using an integer variable for the counter of the loop and a real value for the value of STEP.
Correction
Standardize the types used in the counter of the loop and in the STEP of the loop. The same type must be used.
Examples

Using an integer in the counter of the loop and a real in the STEP of the loop

Code triggering the error
I is int
FOR I=1 TO 10 STEP 0.4
        IF COL_Software[I]=2 THEN
                TABLE_TABLE1[I][2]..BrushColor = LightBlue
        END
END
Possible correction
Use the integer type for STEP.
In this example, the repetition will not be performed: the calculation performed for the first value of the loop will be: 1 + 0,4 = 1,4. The value 1.4 is rounded to 1. The loop always remains to 1.
I is int
FOR I=1 TO 10 STEP 1
        IF COL_Software[I]=2 THEN
                TABLE_TABLE[I][2]..BrushColor = LightBlue
        END
END
Minimum version required
  • Version 0
This page is also available for…
Comments
Click [Add] to post a comment