INC and DEC

Feature requested and implemented
Post Reply
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

INC and DEC

Post by Fernando Perez »

In one of the examples that cicciocb has proposed, [Local Link Removed for Guests], I notice that it already uses the INC function, although I assume that it will only be incorporated in the latest versions of Annex :
INC x equals x = x + 1
I see that the inverse function, DEC, also works:
DEC x equals x = x – 1
This fixes an old Electroguard wish. Congratulations, because I find it very useful. I wanted to propose that before its publication and definitive documentation, the names should be changed to INCR and DECR, which seem more representative and do not lead to errors in the case of DEC (by decimal).
Building on the message, I wanted to propose that you add two constants to Annex, FALSE (= to 0) and TRUE (= to 1).
And that, in the routines defined by the user, it offers the possibility of allowing the omission of some parameters when calling them, replacing their content with default values. It should be possible because lots of Annex instructions do this. Specifically, the parameters enclosed in square brackets in the documentation.
I know this is all whims, but we must begin to respect the whims of our elderly people.
Last edited by Fernando Perez on Fri Jul 28, 2023 11:41 am, edited 1 time in total.
User avatar
cicciocb
Site Admin
Posts: 1989
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 426 times
Been thanked: 1329 times
Contact:

Re: INC and DEC

Post by cicciocb »

yes I implemented inc and dec since some time.

The syntaxi is
INC variable [,increment]
DEC variable [,decrement]


so
INC a -> = a + 1
INC a, 2 -> a=a+2
INC a,b -> a = a+b
the same for DEC

Yes, I can rename INC and DEC to INCR and DECR and also create TRUE and FALSE
about the default value, I must see the effort required and the impact on the performances
User avatar
cicciocb
Site Admin
Posts: 1989
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 426 times
Been thanked: 1329 times
Contact:

Re: INC and DEC

Post by cicciocb »

Implemented in version 1.50.5 but renamed as INCR and DECR in version 1.50.8 (final names)
Post Reply