$increment is (or used to be) unique in that it was the only function that changed its argument. It reminded me of learning about "destructive functions" in LISP a long time ago. No matter where/how you use it, it increments. So "set a = $increment(a)" is redundant, but still OK to use. As you saw, developers started to use "if $increment(a)" alone, because that was shorter but also works fine, even thought it looks strange. I wasn't aware of "do $increment(a)" being allowed, which does look nicer, so I also learned something new from this thread, thanks.
And let's not forget to mention the popular and useful "set a($increment(a)) = something"
I never encountered this issue. I assume it's because AutoSave is off by default, and Steve and others that have commented turned it on. I noticed that there IS a setting called "Auto Save When No Errors."
![Open Sesame!](https://community.intersystems.com/sites/default/files/badges/303371180-6de11138-f4e7-4113-b5cc-836269f07693.png)
![1,000 Points](https://community.intersystems.com/sites/default/files/badges/290121674-53216c4b-fe0c-44e7-9d75-2f24390135ed.png)
![Challenge Starter](https://community.intersystems.com/sites/default/files/badges/295959213-b83dd91a-663f-4f07-8e0e-e3287b7c2309.png)
![5,000 Points](https://community.intersystems.com/sites/default/files/badges/290121698-6976e2e4-084b-4026-bc5f-728c5e1ebe41.png)
![Popular writer](https://community.intersystems.com/sites/default/files/badges/poular_writer.png)
![Notable writer](https://community.intersystems.com/sites/default/files/badges/303371140-d391d770-6fa4-4540-a8d5-926f8dfe9f61.png)
![Reporter Badge](https://community.intersystems.com/sites/default/files/badges/reporter_badge_0.png)
Common Table Expressions are now supported starting with v2024.1: https://docs.intersystems.com/irisforhealth20241/csp/docbook/DocBook.UI....