How should I write a better pseudocode for a for loop where its index starts with 2?
for(i=2; i<n; i )
I want it to be formatted like this
Code:
for(i=0; i<n; i )
Pseudocode
FOR each element in the array
CodePudding user response:
There are different ways to write this, depending on the situation, but i would suggest you to write: "For i = 2 upto n"
Doing this, the reader knows that "i" will go up to "n" and be incremented each iteration.
You can also write: "For i = 2 to n", if the value of n is given as higher than 2 earlier in the code.
CodePudding user response:
For all values of i
starting at 2 and less than n