#75985 - deltree - Fri Mar 17, 2006 12:40 pm
hi,
I made this code:
but I wonder about something:
does the "return" immediatly break the "for" loop and exit the function ?
or is the "for" loop prioritary and will only return the last "return" value at the end ?
I made this code:
Code: |
for (i=0;i<4;i++) //colonne
{ for (j=0;j<4;j++) //ligne { if ((block[current_shape].shape[i][j+block[current_shape].pos]=='X') && (aire[j+yoffset+1][i+xoffset]!='.')) { insert(); ham_VBAText("collision under\n"); return 1; } if ((block[current_shape].shape[i][j+block[current_shape].pos]=='X') && (aire[j+yoffset][i+xoffset+1]!='.')) { ham_VBAText("collision right\n"); return 2; } if ((block[current_shape].shape[i][j+block[current_shape].pos]=='X') && (aire[j+yoffset][i+xoffset-1]!='.')) { ham_VBAText("collision left\n"); return 3; } } } |
but I wonder about something:
does the "return" immediatly break the "for" loop and exit the function ?
or is the "for" loop prioritary and will only return the last "return" value at the end ?