I'm randomly selecting a flag and corresponding country using VBScript. Because of the way I'm generating the code (programmatically), each Case statement will end up on a single line.
I know to use the colon (":") after the Case x: to keep the flag var on the same line. Adding the country var to the line breaks the code though.
What is the proper syntax for this line?
Current code sample:
Select Case rndCountry
Case 0: flag="af" country="Afghanistan"
Case 1: flag="al" country="Albania"
Case 2: flag="dz" country="Algeria"
Case 3: flag="as" country="American Samoa"
Case 4: flag="in" country="Andaman Islands"
Case 5: flag="ad" country="Andorra"
Case 6: flag="ao" country="Angola"
Case 7: flag="ai" country="Anguilla"
Case 8: flag="aq" country="Antarctica"
Case 9: flag="ag" country="Antigua and Barbuda"
Case 10: flag="ar" country="Argentina"
Case 11: flag="am" country="Armenia"
Case 12: flag="aw" country="Aruba"
Case 13: flag="ac" country="Ascension Island"
End Select
The above code yields the "Expected end of statement" error.
VBScript uses new lines to determine where one statement starts and another one begins, but you can use a colon to terminate a statement instead which allows you to span multiple statements across one line.
For example:
Case 0: flag="af": country="Afghanistan"
Is the equivalent of:
Case 0
flag="af"
country="Afghanistan"