Var vs Dim

A prime example being VS Code

I have been using Dim for Arrays and Var for variables too! It just makes sense to me. Not that it makes any real difference functionally. But I just don’t think of allocating an integer, long etc. as ā€œDimensioningā€ whereas I think it fits very well when allocating space for an array.

I find such thing just a kind of bureaucracy, to my eyes it will look like as if someone started a code update and did not finish it.

DIM really looks like 80’s content to me, from a ZX81 or TRS-80.

1 Like

I’ve been using our favorite language since it was called CrossBasic. I see no point using Var when good old Dim works fine… Doesn’t mean I don’t use API2. Just that muscle memory takes over when declaring variables…

2 Likes

I was just trying to make the point that using Var instead of Dim would be an easy way for humans and AI’s to understand that the code was API 2.

…and Slack, Discord, Spotify and many more using Chromium’s V8 JIT compiler :wink:

For me, for reasons I can’t explain, my brain made the switch to var effectively instantly. I never write dim anymore. It feels kind of like I’m writing deprecated code. Logically, I know it makes no difference, but in the moment, using dim feels like I’m doing a bad thing.

What’s also interesting is the only other language I (often) use that uses declaration keywords is JavaScript. But in JavaScript, var is the ā€œbadā€ one. Only in very rare circumstances do I want to declare a global variable. It’s usually const, sometimes let.

1 Like