Inc Dec field



Inc Dec field
Smart pascal source code
type TTest = class Field: Integer; procedure IncDec; procedure IncDecN(n: Integer); end; procedure TTest.IncDec; begin Inc(Field); WriteLn(Field); Dec(Field); WriteLn(Field); end; procedure TTest.IncDecN(n: Integer); begin Inc(Field, n); WriteLn(Field); Dec(Field, n); WriteLn(Field); end; TTest.Create.IncDec; TTest.Create.IncDecN(2); var t := new TTest; Inc(t.Field); WriteLn(t.Field); t.IncDec; Dec(t.Field); WriteLn(t.Field); Inc(t.Field, 2); WriteLn(t.Field); t.IncDecN(3); Dec(t.Field, 1); WriteLn(t.Field); {<<< RESULT - CONSOLE LOG >>> ----------------------------- 1 0 2 0 1 2 1 0 2 5 2 1 ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}