06-18-2003, 09:26 PM
Hi
I'm new to programming in general and starting with QBasic. I've been using the book SAMS TY Beginning Programming and can't get past the section on using the SELECT CASE statement.
The code printed below keeps causing me problems: Can anyone undertsand what's wrong?
' Prints a description based on user's number
INPUT "How many years have you been in school"; years
SELECT CASE years
CASE 1
PRINT "This is your first year"
CASE 2
PRINT "This is your second year"
CASE 3
PRINT "This is your third year"
CASE 4
PRINT "This is your fourth year"
CASE ELSE
PRINT "You did not enter 1, 2, 3, or 4"
END SELECT
END
I keep getting an error message saying that it is illegal to use a statement between CASE SELECT and CASE 1 commands. :o
Any help will be gratefully accepted.
netwarriorgizmo :roll:
I'm new to programming in general and starting with QBasic. I've been using the book SAMS TY Beginning Programming and can't get past the section on using the SELECT CASE statement.
The code printed below keeps causing me problems: Can anyone undertsand what's wrong?
' Prints a description based on user's number
INPUT "How many years have you been in school"; years
SELECT CASE years
CASE 1
PRINT "This is your first year"
CASE 2
PRINT "This is your second year"
CASE 3
PRINT "This is your third year"
CASE 4
PRINT "This is your fourth year"
CASE ELSE
PRINT "You did not enter 1, 2, 3, or 4"
END SELECT
END
I keep getting an error message saying that it is illegal to use a statement between CASE SELECT and CASE 1 commands. :o
Any help will be gratefully accepted.
netwarriorgizmo :roll: