# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Newcomers DBPro Corner / What is wrong with this code?

Message
Posted: 21st Dec 2002 12:13
Hi im trying to find out how my code is wrong what i need it to do is if you answered say 6 to 10 for the first question and 4 to 8 in the second question and 3 to 7 in the third question, you would be called an elf (it is for a fantasy game).

Here is the code:

INPUT "What is your name? ",name\$
PRINT "So"
PRINT name\$
INPUT "How many times did you keep the ball bouncing on the full? ",ball\$
INPUT "How far did you do the standing jump? ",jump\$
INPUT "How fast (in seconds) did you run twenty metres? ",run\$
IF ball\$ = 10
IF jump\$ = 4
IF run\$ = 5
THEN PRINT "You are an Elf"
Posted: 21st Dec 2002 12:41
You should use # for integers not \$

Try somthig like this:

INPUT "What is your name? ",name\$
PRINT "So"
PRINT name\$
INPUT "How many times did you keep the ball bouncing on the full? ",ball#
INPUT "How far did you do the standing jump? ",jump#
INPUT "How fast (in seconds) did you run twenty metres? ",run#
Total# = (ball# + jump# + run#)
IF Total# = 19 then print "You are an Elf"

cheers

Watch the bouncing cursor - now in 3d
Posted: 21st Dec 2002 13:01
cool thanks but how do i get it if i put in 6 to 10 for the first question or 4 to 8 for the second and 3 to 7 for the third because i dont need the EXACT number just one from around that range so the total in number would be (if your an elf in the game) 13 to 25.

Posted: 21st Dec 2002 16:06
Try
IF Total# >= 13 AND Total# <= 25 Then print "You are an Elf"

Whatever I did I didn't do it!