Dark Bit Factory & Gravity
PROGRAMMING => Other languages => Yabasic => Topic started by: bailey96 on December 17, 2012
-
Hi, New to this and just wanted to know how to add a question into yabasic
please see example.
Print "welcome user"
sleep (5)
print "what is your name"
input a
if a=james
goto 1
//what goes here? to stop it if its wrong ?
1thanks James
-
When you say question do you mean using the input command or using if then else statements? Maybe this example will clear things up a little
rem this is a string input
print "Hello my name is yabasic"
input "What is your name?" Name$
print "Hello " + Name$ + " nice to meet you"
rem this is a numeric input
print "So " + Name$ + " can you answer this question for me"
print "I have 3 apples and I share 1 of my apples with you"
input "How many apples do I have left?" NumApples
if (NumApples = 2) then
print "Correct " + Name$ + " I have exactly 2 apples left."
elsif (NumApples < 2) then
print "No " + Name$ + " I have 2 apples left."
elsif (NumApples > 2) then
print "No " + Name$ + " I have 2 apples left."
else
print "No " + Name$ + " I have 2 apples left."
endif
-
If James's example is literally correct,
it's something I've wanted to know.
How do you match letters?
If any name is inputted, it will go to 1.
All I've come up with is reverting to chr$
'right answer is VANCE
Print "welcome user"
pause 1
label again
print "what is your name"
input a$
if a$=chr$(86)+chr$(65)+chr$(78)+chr$(67)+chr$(69) print "right"
if a$<>chr$(86)+chr$(65)+chr$(78)+chr$(67)+chr$(69) goto again
print
print chr$(86);
print chr$(65);
print chr$(78);
print chr$(67);
print chr$(69)