SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 710 | Next

David A. Karp

"Windows Vista Annoyances: Tips, Secrets, and Hacks"

")
MyIQ = InputBox("Please type your IQ.")
If MyShoeSize > MyIQ Then
MsgBox "You need to read more."
Else
MsgBox "You need larger shoes."
End If
One of the nice things about VBScript is that most of the commands are in
plain English; you should be able to follow the flow of the program by just
reading through the commands. Before you run the previous script, try to
predict what will happen for different values entered at each of the two
InputBox statements.
This script uses the If...Then structure to redirect output depending on the
two values entered at runtime (when the script is actually being executed). It
should be evident that the first message is displayed if the value of
MyShoeSize is larger than the value of MyIQ. In all other cases (including when
both values are equal), the second message is displayed. Note also the use of
End If, which is required if the If...Then structure spans more than one line,
as it does in this example.
The If...Then structure can have as many elements as you need. For example:
Crashes = InputBox("How many times a day does Windows crash?")
If Crashes <= 3 Then
MsgBox "You lucky sod..."
ElseIf Crashes = 4 or Crashes = 5 Then
MsgBox "The national average: good for you!"
Else
MsgBox "Take two aspirin and call me in the morning."
End If
accommodates three different ranges of answers to the question posed by
the first line of code (thanks to the ElseIf line). Note also the use of or on
the fourth line; you could also use and here, or a combination of the two.


Pages:
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6