IfFirst.vbhtml
@Code
DimpayhrAsDecimal=25.00
DimhrswkAsDecimal=42.5
DimpayAsDecimal=0
Ifhrswk40Then
pay=payhr*40+(hrswk-40)*payhr*1.5
Else
pay=payhr*hrswk
Endif
@pYour pay is @pay</p
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleCalculate Pay</title
</head
body
h1Calculating Pay</h1
@Code
@pRepeating: Your pay is @pay</p
End Code
</body
</html
IfFirsta.vbhtml
@Code
DimpayAsDecimal=0
IfIsPostThen
IfRequest("payhrUser")IsNot""And _
Request("hrswkUser")IsNot""Then
Dimpayhr=Request("payhrUser")
Dimhrswk=Request("hrswkUser")
Ifhrswk40Then
pay=payhr*40+(hrswk-40)*payhr*1.5
Else
pay=payhr*hrswk
Endif
@pThe pay is @pay</p
Else
@pProblem with calculation</p
EndIf
Else
@pNo result was calculated</p
Endif
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleCalculate Pay</title
</head
body
h1Calculating Pay</h1
pEnter pay per hour and hourse worked to calculate your pay and then click on Submit.</p
formaction=""method="post">
pPay per Hour:
inputtype="text"name="payhrUser"/</p
pHours Worked:
inputtype="text"name="hrswkUser"/</p
pinputtype="submit"value="Submit"/</p
</form
pAfter calculating your pay: @pay</p
</body
</html
IfSecond.vbhtml
@Code
Dimamt1AsDecimal=25.00
Dimamt2AsDecimal=10
Dimamt3AsDecimal=15
DimcodzAsString="A"
DimmsgAsString=""
Ifcodz="A"And(amt120oramt2>=20)Then
msg="True"
Else
msg="False"
Endif
@pYour message is @msg</p
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleConditions</title
</head
body
h1If condition A and either condition B or condition C</h1
@Code
@pRepeating: Your message is @msg</p
End Code
</body
</html
IfSeconda.vbhtml
@Code
Dimamt1AsDecimal=25.00
Dimamt2AsDecimal=10
Dimamt3AsDecimal=15
DimcodzAsString="B"
DimmsgAsString=""
Ifcodz="A"And(amt120oramt2>=20)Then
msg="True"
Else
msg="False"
Endif
@pYour message is @msg</p
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleConditions</title
</head
body
h1If condition A and either condition B or condition C</h1
@Code
@pRepeating: Your message is @msg</p
End Code
</body
</html
IfSecondb.vbhtml
@Code
Dimamt1AsDecimal=25.00
Dimamt2AsDecimal=10
Dimamt3AsDecimal=15
DimcodzAsString="A"
DimmsgAsString=""
@*If codz = "A" And (amt1 > 20 or amt2 >= 20) Then *@
Ifcodz="A"Then
Ifamt120then
msg="True, codz is A and amt1 > 20"
Else
Ifamt2>=20Then
msg="True, second chance worked since codz is A and amt2 is greater or equal to 20"
else
msg="False, codz is A but neither amt1 is greater than 20 or amt2 is greater or equal to 20"
Endif
Endif
Else
msg="False, codz not A"
Endif
@pYour message is @msg</p
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleConditions</title
</head
body
h1If condition A and either condition B or condition C</h1
@Code
@pRepeating: Your message is @msg</p
End Code
</body
</html
IfSecondc.vbhtml
@Code
Dimamt1AsDecimal=15.00
Dimamt2AsDecimal=100
Dimamt3AsDecimal=15
DimcodzAsString="A"
DimmsgAsString=""
@*If codz = "A" And (amt1 > 20 or amt2 >= 20) Then *@
Ifcodz="A"Then
Ifamt120then
msg="True, codz is A and amt1 > 20"
Else
Ifamt2>=20Then
msg="True, second chance worked since codz is A and amt2 is greater or equal to 20"
else
msg="False, codz is A but neither amt1 is greater than 20 or amt2 is greater or equal to 20"
Endif
Endif
Else
msg="False, codz not A"
Endif
@pYour message is @msg</p
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleConditions</title
</head
body
h1If condition A and either condition B or condition C</h1
@Code
@pRepeating: Your message is @msg</p
End Code
</body
</html
LoopFirst.vbhtml
@Code
Fori=1to12
@pMonth of the Year @i</p
Nexti
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleLoops</title
</head
body
h1Months of the year</h1
@Code
Fori=1to12
@pMonth of the Year @i</p
Nexti
End Code
</body
</html
LoopFirsta.vbhtml
@Code
DimmonthsYr()asstring={"January","February","March","April","May","June","July","August","September","October","November","December"}
Fori=1to12
@pMonth of the Year @i is @monthsYr(i-1)</p
Nexti
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleLoops</title
</head
body
h1Months of the year</h1
@Code
Fori=1to12
@pMonth of the Year @i is @monthsYr(i-1)</p
Nexti
End Code
</body
</html
LoopFirstb.vbhtml
@Code
DimmonthsYr()asstring={"January","February","March","April","May","June","July","August","September","October","November","December"}
ForEachmthInmonthsYr
@pMonth of the Year is @mth</p
Nextmth
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleLoops</title
</head
body
h1Months of the year</h1
@Code
ForEachmthInmonthsYr
@pMonth of the Year is @mth</p
Nextmth
End Code
</body
</html
LoopFirstc.vbhtml
@Code
DimctAsInteger=0
DoWhilect12
ct=ct+1
@pMonth of the Year @ct</p
Loop
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleLoops</title
</head
body
h1Months of the year</h1
@* Note I added to ct before the display because it was initially defined as 0 *@
@Code
DoWhilect12
ct=ct+1
@pMonth of the Year @ct</p
Loop
End Code
</body
</html>
ArrayFirst.vbhtml
@Code
DimmonthsYr()asstring={"January","February","March","April","May","June","July","August","September","October","November","December"}
ForEachmthInmonthsYr
@pMonth of the Year is @mth</p
Nextmth
@pThe length of the array is @monthsYr.Length</p
@pAugust is in position @Array.IndexOf(monthsYr,"August") because the array starts with 0</p
Array.Reverse(monthsYr)
ForEachrevMthInmonthsYr
@p@revMth</p
NextrevMth
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleArrays</title
</head
body
h1Months of the year</h1
</body
</html
ArrayFirstb.vbhtml
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleArrays</title
</head
body
h1Months of the year</h1
@Code
DimmonthsYr()asstring={"January","February","March","April","May","June","July","August","September","October","November","December"}
ForEachmthInmonthsYr
@pMonth of the Year is @mth</p
Nextmth
@pThe lenght of the array is @monthsYr.Length</p
Array.Reverse(monthsYr)
ForEachrevMthInmonthsYr
@p@revMth</p
NextrevMth
End Code
</body
</html
DictionaryFirst.vbhtml
@Code
DimtheGrades=NewDictionary(OfString,Integer)()
theGrades.Add("Susan",93)
theGrades.Add("Bill",90)
theGrades.Add("Linda",88)
theGrades.Add("John",89)
theGrades.Add("Mary",84)
End Code
!DOCTYPEhtml
htmllang="en">
head
metacharset="utf-8"/>
titleDictionary</title
</head
body
h1Months of the year</h1
pThe test for Linda is @theGrades("Linda")%</p
pThe test for John is @theGrades("John")%</p
@Code
theGrades("John")=91
@pThe test score for John is now @theGrades("John")%</p
End Code
</body
</html