This behavior is correct. Pre-increment (++v) increments the variable and uses its value. Post-increment uses the current value, THEN increments the value at the end of the operation.
Cheers, Jim On Wed, Jan 24, 2018 at 12:37 William <willi...@gmnameplate.com> wrote: > Hi, > > > After doing some very odd testing, I'm seeing some answers from jbase that > I wasn't expecting. I'm interested in the why piece of it. > > In the program below, lines 4 thru 10 are behaving as I would expect, but > lines 15 and 19 for the first crt K value looks to be wrong. Even though > lines 14 and 18 set K=2, it appears K=3. Hopefully highlighting the pieces > makes it a little bit more clear. > > 001 > 002 VALS= 1: @AM: 2: @AM: 3: @AM: 4: @AM: 5 > 003 > 004 K= 2 > 005 CRT "K after= ": K:; CRT SPACE(5): VALS<K++> > 006 CRT "K= ": K > 007 CRT > 008 K= 2 > 009 CRT "before K= ": K:; CRT SPACE(5): VALS<++K> > 010 CRT "K= ": K > 011 > 012 CRT "***"; CRT "***"; CRT "***" > 013 > 014 K= 2 > 015 CRT "K after= ": K: SPACE(5): VALS<K++> > 016 CRT "K= ": K > 017 CRT > 018 K= 2 > 019 CRT "before K= ": K: SPACE(5): VALS<++K> > 020 CRT "K= ": K > > > > K after= 2 2 > K= 3 > > before K= 2 3 > K= 3 > *** > *** > *** > K after= 3 2 > K= 3 > > before K= 3 3 > K= 3 > > > After making the line 18 change, I'm seeing the following so it doesn't > look unique to # 2.: > > 018 K= 1 > 019 CRT "before K= ": K: SPACE(5): VALS<++K> > 020 CRT "K= ": K > > > before K= 2 2 > K= 2 > > > > > > Thanks, > William > > -- > -- > IMPORTANT: T24/Globus posts are no longer accepted on this forum. > > To post, send email to jBASE@googlegroups.com > To unsubscribe, send email to jbase-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/jBASE?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "jBASE" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jbase+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- IMPORTANT: T24/Globus posts are no longer accepted on this forum. To post, send email to jBASE@googlegroups.com To unsubscribe, send email to jbase-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jBASE?hl=en --- You received this message because you are subscribed to the Google Groups "jBASE" group. To unsubscribe from this group and stop receiving emails from it, send an email to jbase+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.