speedwie
speedwie

Reputation: 75

What could be the meaning of a variable in all capital letters?

I am doing homework that has two variables, BOOK and MAGAZINE, in all capital letters, and I can not figure out what could be the purpose of it.

Anyone have a clue?

The icon in Visio Class Diagram looks like a rectangle with an equal sign on it and a lock declaring it as private.

Regards.

Upvotes: 5

Views: 4851

Answers (2)

Paul Whalen
Paul Whalen

Reputation: 451

Variables in all capital letters in any language generally refer to constants, meaning the value should never change.

In this case, they could refer to an enumerated type, which is a special sort of constant basically is just a symbol for itself.

Upvotes: 3

Stefan H
Stefan H

Reputation: 6683

They are private constants. You can tell by the icon next to their name. Take a look at the constant TEST in this example...

Screen shot of private const in C# with intelisense

EDIT: The all caps is merely by convention, but is usually used to represent constants.

Upvotes: 6

Related Questions