Simba Code:If Tries > 0 And
((Tries Mod 5) = 0) Then LastStep;
How do you mod?
<3
Easy question, but it made for a good thread title hauh?!
Simba Code:If Tries > 0 And
((Tries Mod 5) = 0) Then LastStep;
How do you mod?
<3
Easy question, but it made for a good thread title hauh?!
Simba Code:writeln(12 mod 5);
edit: it seems like ur doin it right in your code
edit2:
Simba Code:{insert big number} mod {insert small number}
Last edited by x[Warrior]x3500; 03-05-2013 at 10:54 PM.
My Tries is being inced, so at first it's smaller.
I guess I should do If Tries > 5 then If Tries Mod 5=0 then?
except properly?![]()
Works like a charm:
Simba Code:program new;
Var
Tries: Integer;
begin
Tries := 0;
repeat
writeln(Tries);
If ((Tries > 0) And (Tries Mod 5 = 0)) Then
writeln('laststep');
Inc(Tries);
until(Tries = 50);
end.
Working on: Tithe Farmer
Yeah it was just weird random stuff going wrong.
Dem extra (((())((()()((()(s never hurt, thanks guys
Simba Code:If ((Tries > 0) And (Tries Mod 5 = 0)) Then LastStep;
Repped you masterBB for this and my last help thread, enjoy your extra square!
Thanks, well for your reputation power I guess I can give an explanation why too. ^^
In pascalscript there is a certain order of calculating equations with different mathematical operators. It doesn't matter in which order you type it, it will just go through this order. An example would be:
10 + 5 * 5
Where you can clearly see that multiplying is done before adding. This of course equals what you learned at elementary school with Math. Now, it gets interesting when you use mathematical operators you haven't heard of at school. Shr, Shl and Mod are examples. What you might not know is that And is also one of these operators. It is a Bitwise operator, it basically checks for what bits are both 1's.
example:
10 < 19 and (10 mod 8) = 2
The problem is this. The first thing it will do are the parentheses. So you will get:
10 < 19 and 2 = 2
The next step will be the And operator since bitwise operators are very high on the list of Mathematical operators. Much higher then < and =, these are actually pretty low on the list. So the next step will be:
10 < 2 = 2
Now this will give an error in pascalscript, and unexpected results in lape.
Want to know more about bitwise operators? Yakman(there are also some others) wrote a tut about it: http://villavu.com/forum/showthread.php?t=18514
Last edited by masterBB; 03-06-2013 at 12:14 AM. Reason: grammar :O
Working on: Tithe Farmer
There are currently 1 users browsing this thread. (0 members and 1 guests)