You don’t need to, again it’s just a preference i’d like to see. No need to understand a simple space or no space inbetween.
None of those are correct.
Var x As integer = 0
x = + 1 // Syntax error
x =+ 1 // Syntax error, the correct form is X += 1
x = +1 // Clearly X = 1, you just assigned the value +1 to X.
x inc 1 // Not been asked for but could be.
Edited the post, i removed the “x = -1” since that wasn’t intentional. But you know what i mean by the others. The engineers know what they are doing so don’t be afraid it won’t work
Because, allowing spaces makes the operations unworkable.
X + = 1 // does this means assign +1 to X or does it mean increment X by 1.
Edited the post, i removed the “x = +1” since that wasn’t intentional. That’s already existing.
You say “Syntax error” come on, this is pseudo code…

Edited the post, i removed the “x = -1” since that wasn’t intentional.

come on, this is pseudo code…
The problem is that your pseudo code (negatives at least) works today with Xojo:
var x as integer = 5
x = - 1 //-1
x =- 1 //-1
x = -1 //-1
you can try if you wish.
I understand you, there is no need to move past this point.
Again i edited the post, as some already stated the spacing must be correct.
I just see not as an issue for this forum to further discuss since that’s what the xojo egineers can solve. (e.g. it’s up tho them anyway how this would result)

You cannot have spaces between +=, -=, /= or *= operators, precisely to avoid such issues. That would be a syntax error.
Guys, don’t try to invent too much. VB, the inspiration of Xojo,
has += , -= , /=, \=, ^=, *= , <<=, >>= and &=
They don’t have ++
and --
, just copy that.
It’s a feature request. The point of the discussion is to try and agree with what we want, or at least work through options.
It works this way:
<variable> [spaces] <assignment-operator> [spaces] <expression>
That means that if compiler gets one valid token known as a defined valid symbol of a variable, and the next token is one of =, += , -= , /=, \=, ^=, *= , <<=, >>= or &=, then we are in a valid context of an assignment and the next part is one expression, that can be a multitude of valid things for that context, including a +1, 1, or -1. So a x+=+1 can be valid but would be better written as x += +1 or simply x += 1.
They could implement them in parts. += and -= being the most desired to start.

If you programmed some C based language you must know that they aren’t, and people will make wrong assumptions if we can’t have it working as they expect as in all other variants.
You can see how it’s already confusing for users who “think” they know. Now imagine users like me who barely learnt C; surely, I don’t want to start seeing this in Xojo.
It isn’t only a C thing. += is in Python, JavaScript, PHP, VB etc. It was even in Clipper and dBase, languages that date back to the days of MS/DOS.
All of them are high level languages, like Xojo. VB is even a Basic language.
It has advantages:
- It is safer, you can’t get two different variables by mistake.
- It shows your intent more obviously. You are incrementing (for +=) a variable, not assigning to a different one.
Nobody is suggesting that you have to use the syntax. Stick with what you want. I only ask that those of us who want that ability are actually allowed to use it.
Years ago I made an request which may be merge with this one.
If you do:
b = 3
a = 6
b = 1
Then a will remain to 6. If you do the same thing will FolderItem or Date, then a will be “linked” to b then it will have the same value (because FolderItem and date are ref as far as I understood).
I suggested that for ref we use another symbol than = because when I began with Xojo I searched a long time what I did wrong (I didn’t understand why a was modify).

x = --1
This as others have pointed out results in a value of 1. That’s because in mathematics minus a negative number produces a positive number.
Just a note, if you wish to support this feature request, please click the link in the first post and click the thumbs up on the request. Pressing the heart button is great, but it doesn’t count towards the request.

imagine users like me who barely learnt C
It does not affect the life of people not using it.
If it’s to enter into your brain, just keep using the long “something = something + 1”. There’s no reason to be a Luddite.
For the sake of fun, let’s compare the FORTRAN I learnt in the 70’s with the current one. Yes, FORTRAN still exists.
C *THIS PROGRAM CALCULATES THE SUM OF SQUARES FROM 1 TO N.
C *FORTRAN IV STYLE
INTEGER N, I, SUMSQ
C *READ INPUT VALUE FOR N
WRITE (6, 100)
100 FORMAT (1X, 'ENTER A POSITIVE INTEGER N:')
READ (5, 101) N
101 FORMAT (I10)
C *INITIALIZE SUM OF SQUARES
SUMSQ = 0
I = 1
C *START OF THE LOOP
200 IF (I .GT. N) GOTO 300
C *CALCULATE SQUARE AND ADD TO SUM
SUMSQ = SUMSQ + I*I
C *INCREMENT COUNTER
I = I + 1
GOTO 200
C *END OF LOOP, PRINT RESULT
300 WRITE (6, 301) N, SUMSQ
301 FORMAT (1X, 'THE SUM OF SQUARES FROM 1 TO ', I10, ' IS ', I10)
STOP
END
But in newer versions, 2008+ :
! Same thing. This program calculates the sum of squares from 1 to N.
program sum_of_squares_modern
implicit none
integer :: n ! Hey, Inline comments
integer :: i ! and we can define the types of them
integer :: sum_sq ! <-- the sum of squares
! Prompt the user for input
print *, 'Enter a positive integer N:'
! Read the integer N from standard input
read *, n
! Calculate the sum of squares
sum_sq = 0
do i = 1, n
sum_sq = sum_sq + i**2
end do
! Print the result to standard output
print *, 'The sum of squares from 1 to ', n, ' is ', sum_sq
end program sum_of_squares_modern
I was so used to use GOTO those days. But in the 80’s I completely rewired my brain due to learning Pascal. And needed to relearn again when OOP, event driven programming and threading were introduced. And now a lot of new things exists again, and will not avoid Generics, Async, Lambdas, etc, etc. I’ll use them… or not.. I have choices.
I don’t think this gives Xojo and fundamentally new capabilities, it just saves a little bit of typing.
I’d prefer to have an inline subroutine or macro capability that could be used for this but also more generally to simplify repeated code snippets. I sometimes want some small repeated code that has the same scope as the calling method, so a function call is overkill.
A way to declare a subroutine either globally or within a single method that then is inlined and thus automatically has either global or local scope would be handy.

I don’t think this gives Xojo and fundamentally new capabilities
It gives the capability of being less verbose, something that I like very much.
I prefer to write
ribulosebisphosphatecarboxylaseoxygenase += 3
than
ribulosebisphosphatecarboxylaseoxygenase = ribulosebisphosphatecarboxylaseoxygenase + 3
And Implementing a += and -= is very simple, it is basically the same solver for “=” with an addition or subtraction to the target instead of just “storing” the expression result.
This exists in many languages because it is desired.
Macros are a bit hard to implement.
Yes the syntax is more terse, but the capabilities are not new. Xojo already provides straight forward ways to increment and decrement variables.
Inline subroutines would allow you (or Xojo by default) to create Inc and Dec operators. Plus they could be used for many other frequently used operations.
I see little value in recreating a capability Xojo already has, especially if it is only “partially similar” to something from another language. That would simply add confusion, dissatisfaction, frustration and calls to implement the rest of the C-like functionality.

Inline subroutines
“Inline” subroutines in an IDE that shows only one routine at a time?
Arent Inline subroutines just another “C-like functionality That would simply add confusion, dissatisfaction, frustration and calls to implement the rest of the C-like functionality.”?