Log in

View Full Version : Is this the same thing?



John
05-13-2012, 09:21 AM
Is this:
ExpGained := ExpGained + 387;
The Same as This:
Inc(ExpGained + 387);
Thanks

~John

J J
05-13-2012, 09:30 AM
No, inc does simply increase an integer with one.

program Test;
{$i srl/srl.simba}

procedure Test;
var
ExpGained, ExpGained2: Integer;

begin
ExpGained := (ExpGained + 387);
WriteLn('ExpGained: '+IntToStr(ExpGained)+'');

IncEx(ExpGained2, 387);
WriteLn('ExpGained2: '+IntToStr(ExpGained2)+'');
end;

begin
SetupSRL;
Test;
end.

IncEx does increase an Integer with a number you can specify.
Inc(ExpGained + 387) will also give a compiling error.

Script above:
SRL Compiled in 16 msec
ExpGained: 387
ExpGained2: 387
Successfully executed.

John
05-13-2012, 09:39 AM
ok ty

Abu
05-13-2012, 08:54 PM
Just so you know:


This:
ExpGained := ExpGained + 387;
IS the Same as This:
IncEx(ExpGained, 387);