Asp Variables

Asp Variables

As with every programming language, we work with variables in ASP. These variables can be alphanumeric (sentences, words, letters and numbers) or numeric. Now let's see these examples:

For example,. Day, Salı the name of the variable value of this variable may be Sunday, Monday, Tuesday, etc.. Each variable holds either one or more values, depending on the type. As the name implies, the value of the variable changes! We can make this change; the program itself can.

In VBScript, unlike many other computer programming languages, variables do not need to be defined or tanımlan declared olarak.

If you do not specify an unspecified value to a non-predefined variable, VBScript will accept it perfectly. But this is bad programming. Good programming requires that variables be declared in advance. We do this with the DIM command. The DIM is abbreviated from the Dimension word. Although not very clever, this command allows the computer to specify the size of a memory space as its variable location.



DIM Gun, Month, Student, Note

Gun = “Monday =

Month = “January =

Student = = Ahmet gr

Note = 5


Now we see that we have created four variables: Gun, Month, Student, Note, and we assign ıyla Monday, ”, January,“ bunlar Ahmet uzu and oluştur 5 ”values ​​respectively. If you ask the VBScript interpreter at this point, say, ”Well, tell me, what's the value of the gun variable?“, The interpreter tells you, V What's not to know? Of course it is Monday! Elbette

So how would a description come up?


DIM Guns (31), Months (12), Students (210), Notes (10)


The la containers “obtained by the codes we create with this method can hold multiple values. So:


DIM Guns (7), Months (12), Students (21), Notes (10)

Gunler (1) =) Monday ler

Months (3) =) March lar

Students (12) = iler Ahmet gr

Notes (5) = 5


In this case, the value of the number 1 of Days variable, which can hold 7 different variables, can be kept as olan Monday, tut 12. The value of the Notes variable that can hold a value of 5 will be 5. Variables such as Array Variable or Array are called variables that can hold more than one value.

Array Function:

VBScript has many functions available for use; With one of them, Array, we can easily create array variables.

Let's say, Guns (7) want to create the array variable by filling in the day names:


DIM Guns = Array (”Monday“, ”Tuesday“, ”Wednesday“, ”Thursday“, ”Friday“, ”Saturday“, Ar Sunday ler)


we can create both array-variables; and assign values.

In this way, you can refer to the array variable that we created with the sequence numbers later. For example:

<% = Guns (6)%>

gives us the market. Why is that? Because, the number starts from 0 to not count; hence the Gun-series starts from Gunler (0)!

Don't we distinguish whether the variable is text or number in VBScript?

Yes, we are. If the value of a variable is made up of letters and numbers, that is, if mathematics is not eligible to perform, they are called String (Alphanumeric, character values). There is also a type of variable that can be used to perform mathematical operations: Number.

VBScript asks you to enclose the value that you assign to a variable as an alphanumeric (character, text). For example, you want to assign the value of Ahmet (12) to the variable: You have to include the word ini Ahmet değiş in double quotes. You will not get quotation marks if you use values ​​as numbers. (It is not necessary to say that the numbers you use as numbers can only be numbers!)

If you'd like, let's see how VBScript distinguishes between character-sequence and number variables. Run the following code:



Dim. (2), Total

Degisken (1) = 1 Ahmet gis

Variable (2) = = Velioğlu gis

Total = Variable (1) + Variable (2)


<% = Total%>


Conclusion: AhmetVelioğlu is not? (Note that there is no space in between!) Well; Now type 5 as the variable (1) value, and 10 as the variable (2) value. Run the program again. Result? 510 !? Well; Remove the nails 5 and 10 around the perimeter. Result? 15

The only kind that VBScript uses is called variant. Variant, the character-index (String) can also be the number. However, when a value in a variant is qualified as data, it enters one of the following types:

Boolean The value of the variable is either True or False; The value of True is -1, and the value of False is 0.

Byte can be a numeric value between 0 and 255.

Double is a type of data called floating point value. For positive numbers, it can take a value between 4.9E-324 and 1.8E308, and in negative numbers -4.9E-324 to -1.8E308.

Date / Time Contains date and time information in predetermined formats.

Empty Defined but not yet