What does the "dim" here mean?

Being that I have coded in VB6 and I see this line in my code written by someone else:

int dim = stepsPerRevolution;

What exactly does the “dim” mean? Dimension? I couldn’t find it in the Arduino reference so that is why I ask.

Thanks :slight_smile:

It means whatever the the author meant it to mean.
They could just as well have used "blah" or "rhubarb" - it's just a name.

Looks like you are creating an integer variable called 'dim' and setting it equal to the value stored in variable 'stepsPerRevolution'.

Maybe dim sum

.

Ok, I thought that might be the case but in Visual Basic we used the Dim Statement to declare a variable as a datatype. I guess that is what confused me a bit. It's all good. Just need to remember if it isn't in the Arduino Reference than its most likely just a variable name that someone chose to use. I didn't write the code and "dim" just doesn't make much sense unless you are dimming a display or something.
Thanks guys

Dim Sum. I get it! :smiling_imp:

I'm surprised that VB doesn't reject it because in most dialects of Basic it's a keyword. Normally it's short for the keyword "dimension". You can probably use "dimension" as most Basics allow three letter abbreviations of the base name, like "rem" is short for "remark".

But yeah, you'd have to ask the person that wrote it, as they could just as easily have declared

int bigSpenderAtVegas = stepsPerRevolution;

aarg:
I'm surprised that VB doesn't reject it because in most dialects of Basic it's a keyword. Normally it's short for the keyword "dimension". You can probably use "dimension" as most Basics allow three letter abbreviations of the base name, like "rem" is short for "remark".

But yeah, you'd have to ask the person that wrote it, as they could just as easily have declared

int bigSpenderAtVegas = stepsPerRevolution;

That was my point. VB would reject it. :slight_smile: I am new to arduino on just learning the code etc and have started out with a project that someone else wrote the code for. I was trying to figure out why my stepper motor vibrates and makes a click noise (all while rotating) at very slow speeds. So I decided to look at the code for any errors and noticed the "dim" and it looked odd, mainly because VB wouldn't let you use it like that. Then I looked at the arduino reference and did not see where it was a reserved word or a statement used in the language.

schemer:
What exactly does the "dim" mean? Dimension? I couldn't find it in the Arduino reference so that is why I ask.

On seeing questions like this, I always recommend that the OP google "C++ tutorial" and do the first few chapters of a C++ tutorial. You don't need to know all the esoteric features of the language, but you do want to know the basics of language syntax, variables and types, scope. C++ is old-school and is quite strict about its formal definition. Doing the first half of a structured tutorial will be much better than attempting to code by example.

Perhaps they meant “dim” as in “not a very bright thing to do”. :slight_smile:

PaulMurrayCbr:
On seeing questions like this, I always recommend that the OP google "C++ tutorial" and do the first few chapters of a C++ tutorial. You don't need to know all the esoteric features of the language, but you do want to know the basics of language syntax, variables and types, scope. C++ is old-school and is quite strict about its formal definition. Doing the first half of a structured tutorial will be much better than attempting to code by example.

Always good advice to study the new language before starting. Thanks. I have like 100 VB books and when I looked at my book shelf I found one lonely Visual C++ 5 book. Maybe that will work too. I will probably just buy a good C++ book as I don't mind spending the $$ on a good book that will help out from simple to advanced. Anybody have any suggestions on a great C++ book??

Not a book, but I found this tutorial useful when I started learning C++.

groundFungus:
Not a book, but I found this tutorial useful when I started learning C++.

Cool. Thanks. I will start there...

schemer:
Anybody have any suggestions on a great C++ book??

I learned C out of the K&R "blue book" in '85, and learned C++ in dribs and drabs. Any university or college teaching C++ will have a recommended text. But really - online is cheaper.

The main thing to watch out for is that C++ tutorials won't be written with reference to the arduino environment. Instead of a setup() and loop(), you have a main() that executes once and then the program terminates. And to actually compile and run bare C++ code, you'll need a compiler. Not sure how you would go about using the one that comes bundled with the Arduino IDE. Of course, if you are using a sensible OS like Linux or OSX (with the developer tools), you will already have GNU C++ (gcc).

PaulMurrayCbr:
I learned C out of the K&R "blue book" in '85, and learned C++ in dribs and drabs. Any university or college teaching C++ will have a recommended text. But really - online is cheaper.

The main thing to watch out for is that C++ tutorials won't be written with reference to the arduino environment. Instead of a setup() and loop(), you have a main() that executes once and then the program terminates. And to actually compile and run bare C++ code, you'll need a compiler. Not sure how you would go about using the one that comes bundled with the Arduino IDE. Of course, if you are using a sensible OS like Linux or OSX (with the developer tools), you will already have GNU C++ (gcc).

Yeah, that is great info. I need some book or online source that focuses on the Arduino environment as that is the only place I intend to use it. I'm on Windows, but I do have an older Mac Pro. I think if I just do some research on differences between VB6 and C++ that will clear things up a lot. I did that once before when I was learning RealBASIC.
Thanks