If then in a calculation

For general Flowcode discussion that does not belong in the other sections.
Post Reply
RGV250
Posts: 279
http://meble-kuchenne.info.pl
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 25 times
Been thanked: 30 times

If then in a calculation

Post by RGV250 »

Hi,
I am a bit puzzled if this is possible or not, in the help for calculations it shows >, <, >= and so on but I cannot figure out how to use them.
I would like to be able to do simple things like

xyx = xyz + 1
if xyz > 10 then xyz = 0

So far I have had to do the addition and then use a decision which seems very cumbersome.

Inc and Dec would be a nice feature to add as well to make things tidier.
In a different program I can use

Inc xyz to increment by 1
or
Inc xyz,10 to increment it in steps of 10

Regards,
Bob

mnfisher
Valued Contributor
Posts: 1005
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 106 times
Been thanked: 519 times

Re: If then in a calculation

Post by mnfisher »

One for the first is

Xyz = (Xyz +1) % 10

Which will cycle back to 0 when Xyz reaches 10 - xyz = 0..9

RGV250
Posts: 279
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 25 times
Been thanked: 30 times

Re: If then in a calculation

Post by RGV250 »

Thanks, that is a neat solution.

Bob

Post Reply