Hi,
tried that on TAFC R10 (Change 89685)

Source:

001 PROGRAM KZM.PLUS
002
003 CNT = 3
004 PRINT ++CNT + ++CNT
005
006 CNT2 = 3
007
008 PRINT ++CNT2 + ++CNT2 + ++CNT2
009
010 STOP
011 END

Result:

10
18

It looks that preincrement has preference and it's proceeded in full
before summing ttakes place:

(3+1+1) * 2 = 10

(3+1+1+1) * 3 = 18

why you had 16, I don't understand. Typo?

VK

On Sep 1, 4:34 pm, "[ Xze ]" <[email protected]> wrote:
> Hi all!
>
> My question pertains to the way that jbase treats pre-increments
>
> Consider the following routine:
>
> 0004     PROGRAM MY.MATH
> 0005
> 0006     CNT = 3
> 0007     RES = ++CNT + ++CNT
> 0008
> 0009     PRINT 'RES = ':RES
> 0010     RETURN
> 0011 END
>
> The output result is RES = 10
>
> if i change line 007 to RES = ++CNT + ++CNT + ++CNT,
> then the output result is RES = 16
>
> Can anybody explain this behaviour? (I expected the first case to output RES
> = 9 and the second RES = 15)
>
> My system configuration:
>
> OS      :   AIX 5.3
> jbase   : Major 5.0 , Minor 20 , Patch 0364 (Change 85159)
>
> Regards

-- 
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

Reply via email to