06-29-2025, 01:42 PM
(06-29-2025, 11:58 AM)doppler Wrote: I maybe dreaming in the wrong language here.
Consider I want to increment a variable by 1:
QB64pe way x=x+1
dreaming x=+1
x=+1 is closer to C than the official quick basic language, but can it be made to work as a way in QB64pe ? Would it be worthwhile ??? Or am I just strange ????
I use a lot of variables to act as pointers, arrays and such.
I don't think anything like this would ever end up being added.
Consider this:
x = -1
Now, is that an assignment of x = (-1), or is it a shortcut command to x = x - 1?
It's the same with the x = +1. "+1" is just an explicit way of displaying the sign of the number there. It's not something which we usually see written in code, but it *IS* perfectly valid existing syntax.
Try this, but you'll need to paste it and then compile without hitting any other key at the IDE wants to strip off that explicit + here:
Code: (Select All)
x = 3
x = x + +3
Print x
If written in a different IDE, the above works and runs without any issues. In our IDE, we try to simplify the code by stripping off that explicit plus symbol in there.
It's because of this old functionality where +1 is just an sign-explicit "1", that I don't think we'd ever see something like this pop into the language.
What I personally think would be nice would be the addition of the ANY type.
SUB INC(x AS _ANY)
x = x + 1
END SUB
Then you don't need a function for all those values. It'll pass the value back and forth and match types automatically for you....
Oh... But to dream....

