Skip to main content

Count-from-the-Initial-Value-According-to-the-Step-Size.-Continue-the-Count-Until-the-End-Value

Command Description

Replace the index into the loop and execute the statement block from for to next. The index value is from start to end times, and step is step. Each loop can increase the index by the number corresponding to step instead of 1

Command Prototype

For index = beginValue To endValue step stepValue

Next

Parameter Description

ParameterRequiredTypeDefaultDescription
indexTrueidiStep index
beginValueTruenumber0Initial value
endValueTruenumber10End value
stepValueTruenumber1Step in

Demo

TracePrint("------------------------------------------------Counting loops------- -----------------------------------") 
//-------------------------------------------------------------------------------
//[Remarks] Substitute the index into the loop, execute the statement block between for and next , the value of the index is from start to end times, step is the step, and each loop can increase the index by step corresponds to the quantity, not 1 anymore.
TracePrint("Let i be 0, step size is 1, increment to 10, print the value of i, the result is: ")
For i = 0 To 10 Step 1
TracePrint i
Next