-
-
Save fernandovbs/85c89bcce286da924e54ffda542a9943 to your computer and use it in GitHub Desktop.
Classic ASP/VBSCRIPT Cheat sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Declare a variable and affect a string value | |
dim myvariable | |
myvariable = "Donald Duck" | |
' Change a variable value | |
dim myvariable | |
myvariable = "Donald Duck" | |
myvariable = "Mickey Mouse" | |
' Concatenate strings | |
dim name | |
dim mynameis | |
dim concatenated | |
name = "Jean" | |
mynameus = "my name is : " | |
concatenated = mynameis & name | |
' Create a size determinated array (2) | |
dim tableau(2) | |
tableau(0) = "lundi" | |
tableau(1) = "mardi" | |
tableau(2) = "mercredi" | |
' Resize an array | |
dim tableau(4) | |
redim tableay(5) | |
' Create an undeterminated size array | |
dim tableau | |
tableau = array("lundi" , "mardi" , "mercredi") | |
' LOOPING | |
' for to loop | |
for i = 0 to 5 | |
response.write("The number is " & i & "<br>") | |
next | |
' For each loop | |
dim cars(2) | |
cars(0)="Volvo" | |
cars(1)="Saab" | |
cars(2)="BMW" | |
for each car in cars | |
response.write(car & "<br>") | |
next | |
' Do while loop | |
i = 0 | |
do while i < 10 | |
response.write(i & "<br>") | |
i = i+1 | |
loop | |
' FUNCTION | |
' simples functions | |
function addition(num1 , num2) | |
result = num1 + num2 | |
addition = result | |
end function | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment