To achieve
Which is suitable for the current line, I j for maximum line
While (i<=j)
The begin
If (satisfy conditions)
Execute the statement
I=I + 1
END
Meet the conditions after continue until i> j
CodePudding user response:
DECLARE @ INT I=0;
DECLARE @ INT j=10;
WHILE (@ I & lt;=@ j)
The BEGIN
IF (@ I % 2=0)
The BEGIN
PRINT RTRIM (@ I) + 'is an even number;
END;
The SET @ I=@ I + 1;
END;
0 is even2 is an even number
4 is even
6 is the even
8 is an even number
10 is the even
CodePudding user response:
General language circulation have BREAK, CONTINUE the two key wordsBREAK out of the loop
CONTINUE to end the cycle, the next cycle
While (i<=j)
The begin
If (satisfy conditions)
{
I=I + 1
The CONTINUE
}
I=I + 1
END