3 ms·
That looks a lot like Visual Basic, except it allows you to name the patterns. sub letters dim char as string do char = inputbox("Enter
by ptx 7y ago
That looks a lot like Visual Basic, except it allows you to name the patterns.
sub letters
dim char as string
do
char = inputbox("Enter lower-case character or digit. No data ends.")
select case char
case "a", "e", "i", "o", "u"
msgbox "The letter " & char & " is a vowel."
case "b", "c", "d", "f", "g", "h", _
"j" to "n", "p" to "t", "v" to "z"
msgbox "The letter " & char & " is a consonant."
case "0" to "9"
msgbox char & " is a digit."
case else
exit do
end select
loop
end sub
(This example is actually LibreOffice Basic, as I'm not on a Windows machine right now, but it should be the same in VBA and VB6.)
- msla 7y ago> That looks a lot like Visual Basic, except it allows you to name the patterns. More to the point, it allows you to keep the patterns near the variable declaration, so you can reuse them. The pattern matching is part of how the data is declared.
- ptx 7y agoCan you also reuse them for different variables, if you want to store two of these chars? This program appears to have the patterns declared as part of the variable declaration.