SRL Archive - SRL Suggestions

function multipleinc(number: integer; var x: integer) : integer;


JPHamlett

2009-11-08 10:35:28


function multipleinc(number: integer; var x: integer) : integer;
begin
x := x + number;
result := x;
end;


pretty simple itll help with proggies and stuff like that and idk if its already in scar but i could find it so i made it

Rick

2009-11-08 10:36:51

It's called IncEx in Scar ;)

IncEx(var X; N: LongInt);

JPHamlett

2009-11-08 10:40:05

oh lol iread that wrong in the manual i thought it inc two variables

Awkwardsaw

2009-11-08 10:52:31

also, it could just be

result:= x + number;

e: never mind lol, x is a var :o

Rick

2009-11-08 11:37:18

Also, you could shorten to this:


function MultipleInc(N, var X: Integer) : Integer;
begin
Result := X + N;
end;

You should group the same types.

Edit: :duh: Didn't realise that. Don't group.

JPHamlett

2009-11-08 11:39:03

that wont work lol look at the post above yours

Nava2

2009-11-08 12:53:37

closed, this has been resolved. No need to keep posting :)

Also, should just do
procedure IncEx(var X: Integer, N: Integer);
begin
X := X + N;
end;