Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #38024

Re: Can't use block of statements as 'incrementer' in for loop?

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Robert Spanjaard <spamtrap@arumes.com>
Newsgroups comp.lang.java.programmer
Subject Re: Can't use block of statements as 'incrementer' in for loop?
Date Thu, 15 Feb 2018 12:05:03 +0100
Organization Aioe.org NNTP Server
Lines 24
Message-ID <p63pgv$336$1@gioia.aioe.org> (permalink)
References <p61mgq$10r6$1@gioia.aioe.org> <c4080c02-1eca-4401-9bcc-9c33572d02ef@googlegroups.com>
NNTP-Posting-Host bL5gwq6hANUN7rOnAkKsyA.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
Content-Language en-US
X-Notice Filtered by postfilter v. 0.8.3
Xref csiph.com comp.lang.java.programmer:38024

Show key headers only | View raw


On 14-02-18 19:57, Eric Douglas wrote:
> On Wednesday, February 14, 2018 at 11:01:48 AM UTC-5, Robert Spanjaard wrote:
>> https://docs.oracle.com/javase/tutorial/java/nutsandbolts/expressions.html
> 
> That documentation says "... types of expressions can be made into a statement by terminating the expression with a semicolon"
> 
> as you see in the docs Arne refers to the 'ForUpdate' section may include multiple expressions separated by comma.
> https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.14.1
> 
> So try like this:
>       public static void main(final String[] args) {
>            ArrayList<Integer> a1;
>            for (int i = 1, j; i < 11; j = 2, i++, System.out.println("Hello World!"), a1 = new ArrayList<>(), a1.add(j)) {
>                 System.out.println("Count is: " + i);
>            }
>       }
> 

Yes, but that same doc lists System.out.println as an example of a statement.

But OK, I think Arne and you got me on the right track. Thanks.

-- 
Robert Spanjaard

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can't use block of statements as 'incrementer' in for loop? Robert Spanjaard <spamtrap@arumes.com> - 2018-02-14 17:01 +0100
  Re: Can't use block of statements as 'incrementer' in for loop? Arne Vajhøj <arne@vajhoej.dk> - 2018-02-14 11:13 -0500
  Re: Can't use block of statements as 'incrementer' in for loop? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-02-14 11:34 -0500
  Re: Can't use block of statements as 'incrementer' in for loop? Eric Douglas <e.d.programmer@gmail.com> - 2018-02-14 10:57 -0800
    Re: Can't use block of statements as 'incrementer' in for loop? Robert Spanjaard <spamtrap@arumes.com> - 2018-02-15 12:05 +0100
      Re: Can't use block of statements as 'incrementer' in for loop? Eric Douglas <e.d.programmer@gmail.com> - 2018-02-15 04:49 -0800

csiph-web