Vb dim what does it mean
Active Oldest Votes. Improve this answer. In early releases of basic the only variables that needed to be declared were arrays. The "Dim" keyword was used to set the dimensions of this array. I remember reading a gw-basic programming guide in the early 80's and I explicitly remember it explaining DIM meaning Declare In Memory. One thing to keep in mind is that, in early language development, it was common to overload a keyword to have multiple meanings. Since, in the original Basic, "Dim" was already a keyword used to declare array variables, the keyword was extended to include declaring all variables.
Introducing a new keyword was avoided for multiple reasons, one of which is they didn't want to break existing programs who already used the new keyword as a variable name. Today we have more sophisticated parsing technologies and faster computers, we don't see those types of limitations. For instance, in later Basic, such as Visual Basic, a type and a variable could be the same name. It means different things in different contexts. The more formal definition is on page numbered 37 or 41 in the PDF itself.
Dim have had different meanings attributed to it. Even though, it doesn't say what does Dim stand for, it says on page Now, I got a rewarding surprise later on at page , the title for the section that describes the DIM keyword note: that is not listed in the contents says: DIM dimension of an array So, I didn't get the quote "Dim stands for Again, I didn't find an account on the subject, still I was able to find a definitive quote: Before you can use an array, you must define it in a DIM dimension statement.
NET ;. Community Bot 1 1 1 silver badge. Theraot Theraot I've heard "declare in memory" also. Also I am now going to insist to people that this is what Dim actually stands for — Jacob Stamm. Guffa Guffa k gold badges silver badges bronze badges. JoshBerke JoshBerke Robert Harvey Robert Harvey k 44 44 gold badges silver badges bronze badges.
Shoban Shoban Thornton Thornton 71 1 1 silver badge 1 1 bronze badge. MonstaP MonstaP 87 1 1 silver badge 1 1 bronze badge. AbdulAziz AbdulAziz 5, 13 13 gold badges 52 52 silver badges 75 75 bronze badges. RBT Chandralal Chandralal 2 2 gold badges 9 9 silver badges 25 25 bronze badges.
Welcome to StackOverflow and thank you for this answer, but it doesn't really expand on the numerous other answers that all give the same answer. Instead, you supply arguments, if they are required, to the constructor of the class from which you are creating the variable.
You can declare a variable in a procedure, block, class, structure, or module. You cannot declare a variable in a source file, namespace, or interface. A variable that is declared at module level, outside any procedure, is a member variable or field. Member variables are in scope throughout their class, structure, or module. A variable that is declared at procedure level is a local variable. Local variables are in scope only within their procedure or block. The following access modifiers are used to declare variables outside a procedure: Public , Protected , Friend , Protected Friend , and Private.
For more information, see Access levels in Visual Basic. If Option Explicit is on the default , the compiler requires a declaration for every variable you use. For more information, see Option Explicit Statement. You can assign a value to a variable when it is created. For a value type, you use an initializer to supply an expression to be assigned to the variable.
The expression must evaluate to a constant that can be calculated at compile time. If an initializer is specified and a data type is not specified in an As clause, type inference is used to infer the data type from the initializer. In the following example, both num1 and num2 are strongly typed as integers.
In the second declaration, type inference infers the type from the value 3. Type inference applies at the procedure level. It does not apply outside a procedure in a class, structure, module, or interface. For information about what happens when a data type or initializer is not specified, see Default Data Types and Values later in this topic.
You can use an object initializer to declare instances of named and anonymous types. The following code creates an instance of a Student class and uses an object initializer to initialize properties. You can declare several variables in one declaration statement, specifying the variable name for each one, and following each array name with parentheses.
Multiple variables are separated by commas. If you declare more than one variable with one As clause, you cannot supply an initializer for that group of variables. You can specify different data types for different variables by using a separate As clause for each variable you declare.
Each variable takes the data type specified in the first As clause encountered after its variablename part. You can declare a variable to hold an array , which can hold multiple values. To specify that a variable holds an array, follow its variablename immediately with parentheses.
For more information about arrays, see Arrays. You can specify the lower and upper bound of each dimension of an array. To do this, include a boundslist inside the parentheses. For each dimension, the boundslist specifies the upper bound and optionally the lower bound. The lower bound is always zero, whether you specify it or not. Each index can vary from zero through its upper bound value. The following two statements are equivalent.
Each statement declares an array of 21 Integer elements. When you access the array, the index can vary from 0 through The following statement declares a two-dimensional array of type Double. Note that an upper bound represents the highest possible value for the index, not the length of the dimension. The length of the dimension is the upper bound plus one.
So, I didn't get the quote "Dim stands for With renewed hope, I decided to search about how Dim was chosen. Again, I didn't find an account on the subject, still I was able to find a definitive quote:. A part of the original BASIC compiler source code, where it would jump when finding a DIM command, in which you can clearly see the original intention for the keyword:.
Later on it came to be used to declare all kinds of variables, when the possibility to specify the type for variables was added in more recent implementations. Python Javascript Linux Cheat sheet Contact.
Dim have had different meanings attributed to it. Even though, it doesn't say what does Dim stand for, it says on page Now, I got a rewarding surprise later on at page , the title for the section that describes the DIM keyword note: that is not listed in the contents says: DIM dimension of an array So, I didn't get the quote "Dim stands for Again, I didn't find an account on the subject, still I was able to find a definitive quote: Before you can use an array, you must define it in a DIM dimension statement.
Tags: Vb6 Language Design Basic.
0コメント