Search:

Type: Posts; User: helloworld922

Search: Search took 0.10 seconds.

  1. Re: What can be legally inside FOR statement?

    This is the same as:
    for(int i=0 ; i<100;i++)
    ;
    System.out.println(i);

    An empty semi-colon counts as a statement. So the for-loop statement is the empty statement, and System.out.println()...
  2. Re: What can be legally inside FOR statement?

    No, the parser will take only 1 statement (statement A). The other statements are considered outside the for-loop scope, and thus are not executed as part of the for loop.

    That's be similar to...
  3. Re: What can be legally inside FOR statement?

    No, a statement can be a line statement or a block statement.

    This is perfectly fine code and will print out 0 to 5. However, it is generally considered good practice to wrap statements after...
  4. Re: What can be legally inside FOR statement?

    A for loop must have this syntax (using regex notation where ? means it's optional):
    for(expression?; condition?; expression?)
    statement

    where expression is any valid single expression...
Results 1 to 4 of 4