Why not +=?

I’m fed up with

A_reasonably_named_variable = A_reasonably_named_variable + 1

When almost all other languages use

A_reasonably_named_variable += 1

  1. Python
  2. JavaScript
  3. C
  4. C++
  5. C#
  6. Java
  7. Ruby
  8. Perl
  9. PHP
  10. Swift
  11. Kotlin
  12. Rust
  13. Go
  14. MATLAB
  15. R
  16. Lua
  17. Dart
  18. Groovy
  19. Scala
  20. TypeScript

Only Genius knows…

1 Like

Only the CEO can answer why Xojo doesn’t support +=, -= and !=.

He dislikes them :slight_smile:
And thats usually the end of the discussion

I’d be for adding several of the really common ones


Dunno about others (like ^= |= etc)

edited as \= doesnt show unless its in the code block :slight_smile:

1 Like

adding those operators would make Xojo look like a modern language, and we can’t have that!

Mr Dim… meet Mr. Var


There are users who exactly use Xojo because it has no such kind of harder-to-read “conventions”.


You do not have to use it in Java, C++ and many others. You can still use your integer = your integer +1;

It’s also about reading other’s code.


That’s what comments are for , I do believe 100% in readable code, I don’t think anyone that has ever worked for me has even achieve minimal documentation. However when you use meaningful variable names it does take a lot of time to duplicate the name every time you add something to it.

+= has been around a long time, I was also suggesting to make it an option not replacement.

We finally got Var, time for +=

1 Like

40 years ago PowerBASIC supported incr() and decr() functions…
would be shorter and nicer



a = a + 1

1 Like

Where not talking about pointers here, but you should have an option or programming becomes long winded when you make your variable names meaningful.
A=a+1 would not be an issue.
Counter +=1 is not really hard to read ?

I was just mentioning there are users who have different opinions than yours.

Then Xojo has to remain as a language from the 90th and not change. It is okay when you have a user base for that. And noe the question: is there one? I doubt that. A few users which can’t read code from others? I am sorry but that is not helping anybody. You may have this people. Heck they can’t read the code while not getting that or they have to think about while it is not like it was before 50 years? I am sorry that can not be the argument.

Well, Dim got renamed to Var.

What I would expect when using Var is to use it for implicitly-typed (local) variables, such as:

Var x = 0
Var msg = "Hello"

So what we got from Xojo is a totally unneccessary renaming, which leads to even more confusion since Var can’t do what one would expect (in Xojo)

…but I’d like to see Xojo having a++ and a += 2 (if they want to be more similar/familiar to other languages).


Write yourself a function for it…ahhh ya…no namespaces available…that’s a problem

1 Like

Sure , I have an opinion too if that ok.

1 Like

Perhaps more apropos … VB.NET supports var += value. And my guess is, every other dialect of basic still under development.

a++ and ++a (and a-- and --a) would be nice but probably more difficult. variable += value is just syntax sugar.

In C# I very seldom use ++a but when I have the opportunity and actual need it is very elegant. If you need to increment some variable just before accessing it, it turns this:


… into this:

Whether it’s faster that way is questionable but when you understand what it does it’s very compact (“terse” would be too strong a word) and readable. But some people will prefer the first version … and that’s fine, if that’s your preference, you can still do it.


it is supported by a broad range of languages but not by Xojo. That should be changed.


as I pointed out before… incr() and decr() are still possible to write for anybody him/herself