All About Inc and IncEx
Hello and welcome to my short tutorial about Inc and IncEx. As you may or may not know there are alot of uses for this. Mainly this is used as an alterative to variable adding and subtracting.
Inc
Inc is basically Var := Var + 1, this may seem framiliar to you - rack your brains for this. Yes you guessed this is used in progress reports e.gSo how do we use it?SCAR Code:Banked := Banked + 1;
Arguments for Inc are :
So its usage is basically Inc(Your Variable). For example instead of using Banked := Banked + 1; you can just do -PHP Code:
procedure Inc(var X);
Increases X with 1.
Simple, really? Well what if you want to add more than one to the variable?? Well read on...SCAR Code:Inc(Banked)
IncEx
IncEx is basically the same as Inc as what it does is add or subtract from the variable. This is used when you want to add more than one onto a variable e.g
So How de we use it?SCAR Code:OresMined := OresMined + 27;
Arguments for IncEx are :
So its usage is basically IncEx(YourVariable, Howmuch you add to your var);. For example instead using OresMined := OresMined + 27; just do -PHP Code:
procedure IncEx(var X; N: Integer);
Increases X with N.
Simple you see.SCAR Code:IncEx(OresMined, 27)
Other examples
Munk uses IncEx in his game to add to the score, but remeber you can also use inc like this :Also you may be able to minus the values e.gSCAR Code:For i := 0 to 26 Do
Inc(Var);SCAR Code:IncEx(u, -34)
Hope you all learned something today, Peace out.