Search code examples
javapseudocodedo-loops

"do for" and "do if" in java pseudocode


for an assignment I was given java pseudocode that included lines:

do for i = 0...j-1

do if i = 0 and j = 1

for k = 0....i-1
  do q <- l[k,i] + dist(p[k],p[j])

since the only use for "do" in java that I am aware of in java is do-while loops, (which I am not great with, preferring to stick to for loops), I don't really know how to translate this into java.


Solution

  • Not enough references in your question but i think you can start with :

    int i, j=10;
    for(i = 0; i < j; i++){ //do for i = 0... j-1
        if( i== 0 && j == 1){ // do if i =0 and j = 1
        }
        for(int k = 0; k<i; k++){ //for k = 0....i-1
             //not sure what do you mean by do q <- l[k,i] + dist(p[k],p[j])
        }
    }