Skip to content

Instantly share code, notes, and snippets.

@nicoxxxcox
Last active March 2, 2023 03:17
Show Gist options
  • Save nicoxxxcox/0fc1749b83b3fde5cd8fb28bbe02d850 to your computer and use it in GitHub Desktop.
Save nicoxxxcox/0fc1749b83b3fde5cd8fb28bbe02d850 to your computer and use it in GitHub Desktop.
Classic ASP/VBSCRIPT Cheat sheet
' 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