Just a little one: Arithmetic Increment/Decrement Operators?
Moderator: POL Developer
Just a little one: Arithmetic Increment/Decrement Operators?
Not a biggie, in all honesty, but it'd be a nice little addition
Okay got this to all work properly in runecl
So += -= and such could be a very real possibility in 097.
Gimme some other stuff you would throw at it (only += is in right now) to test...!
Code: Select all
program MathTest()
var i := 5;
i += 3+4;
var j := array;
j[1] := 3;
j[1] += 5;
Print("->"+i);
Print("->"+j[1]);
var temp := "Aust";
temp += "in";
Print("->"+temp);
return 1;
endprogram
Gimme some other stuff you would throw at it (only += is in right now) to test...!
Schweet lookin'...
Only other things I could think of to test out would be:
So, just basically making sure it would all work as expected with structs (and dictionaries, of course), and object members, and also to make sure that adding different types of data doesn't throw monkey wrenches into things.
Only other things I could think of to test out would be:
Code: Select all
program Test(who)
var s := struct;
s.+z := 0;
s.+z_mod := 5;
s.z += 5;
s.z += s.z_mod;
s.z += "what will this do?";
s.z += who; // this, too, just to know.
who.color += 1;
endprogram
Okay heres what I tested in the first code block.
The second is the output given.
The second is the output given.
Code: Select all
program MathTest()
PlusEqualTests();
MinusEqualTests();
endprogram
function PlusEqualTests()
Print("\nPlusEqual Tests()");
var a := 1;
a += 2;
Print("A->"+a);
var b := 1;
b+= 4+3;
Print("B->"+b);
var c := array{1};
c[1] += 3;
Print("C->"+c);
var d := array{"A"};
var e := array{"B"};
d+=e;
Print("D->"+d);
var f := struct;
f.+A := 1;
f.A+=3;
Print("F.A->"+f.A);
var g := "PO";
g+="L";
Print("G->"+g);
var h;
for ( h:=0; h<=2; h+=1 )
print("H->"+h);
endfor
var i := dictionary;
i["A"] := 1;
i["A"] += 3;
Print("i['A']->"+i["A"]);
return 1;
endfunction
function MinusEqualTests()
Print("\nMinusEqual Tests()");
var a := 3;
a -= 2;
Print("A->"+a);
var b := 4;
b-= 3-1;
Print("B->"+b);
var c := array{5};
c[1] -= 3;
Print("C->"+c);
var d := array{"A", {"B"}};
var e := array{"B"};
d-=e;
Print("D->"+d);
var f := struct;
f.+A := 7;
f.A-=3;
Print("F.A->"+f.A);
var g := "POLLL";
g-="LL";
Print("G->"+g);
var h;
for ( h:=3; h>=0; h-=1 )
print("H->"+h);
endfor
var i := dictionary;
i["A"] := 4;
i["A"] -= 3;
Print("i['A']->"+i["A"]);
return 1;
endfunction
Code: Select all
PlusEqual Tests()
A->3
B->8
C->{ 4 }
D->{ A, { B } }
F.A->4
G->POL
H->0
H->1
H->2
i['A']->4
MinusEqual Tests()
A->1
B->2
C->{ 2 }
D->{ A, { B } }
F.A->4
G->POL
H->3
H->2
H->1
H->0
i['A']->1
Okay your wish was granted, we got += -= *= /= and %=
Note: No one ask for i++ ++i i-- --i for a while, thats a whole 'nother story.
Also I went into POL ( I did most my testing in RunECL ) I disabled all the packages except for what was required.. and then did two for loops that started at 0 and counted to 10000
i := i+1 took 30 ms
i += 1 took 20 ms.
Note: No one ask for i++ ++i i-- --i for a while, thats a whole 'nother story.
Also I went into POL ( I did most my testing in RunECL ) I disabled all the packages except for what was required.. and then did two for loops that started at 0 and counted to 10000
i := i+1 took 30 ms
i += 1 took 20 ms.