Page 1 of 1
		
			
				BASIC Help
				
Posted: 
Aug 26, 2004 @ 4:04pm 
				by Caesar
				Here's my very basic code dealing with the random number generator.  I want it so that when the user inputs break or Break the app will jump to label 2 and then end itself.  However, all it does is add a random number to the end of Break.  Also, the random number generator appears to only create a random number > .0.  Any ideas?
Here's my code:
Label 1
randomize 1
input A
if A=Break|break then goto 2 
A=A+RND
print A
goto 1
label 2
end
| means "or"
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 4:17pm 
				by refractor
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 4:24pm 
				by David Horn
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 4:40pm 
				by Caesar
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 4:51pm 
				by Jinks
				INPUT A
PRINT A,Break,break
RUN see what you get, guessing 0,0,0.
Find out what your dealing with. Suspect Break=0 as a default setting for initialising the variable. It'll be an ASCII(4 maybe EOD) value or more likely default to zero again if not set. You've got the whole INKEY or KEY and build your own input emulator if it won't tell you Break. Better way is $ input and check ="" or else EVAL.
In most basics with a fractional RND.
num=((13-6)*RND)+6
to get 6<= num <13 results
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 4:56pm 
				by Caesar
				INPUT A
PRINT A,Break,break 
returns: 0 0
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:00pm 
				by Jinks
				So you hit break on the INPUT a and it returned nothing. Haven't seen behaviour like that since the Sinclair QL automatic string-numer thing which had a very technical term.
Can you 
INPUT A
IF(A="") PRINT "Batman"
See if it spits on the "".
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:04pm 
				by Caesar
				I had to add a "then" to it otherwise it refused to let the PRINT come on the same line after the IF.
Here:
INPUT A
IF A="" THEN PRINT "Batman"
Returns: Batman
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:09pm 
				by Jinks
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:16pm 
				by Caesar
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:26pm 
				by Jinks
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:31pm 
				by Caesar
				
			 
			
		
			
				
				
Posted: 
Aug 26, 2004 @ 5:45pm 
				by Jinks
				
			 
			
		
			
				
				
Posted: 
Aug 27, 2004 @ 2:49pm 
				by Caesar
				
			 
			
		
			
				
				
Posted: 
Aug 27, 2004 @ 4:19pm 
				by Jinks