Qbasicnews.com

Full Version: Help with numeric statmenst please!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im new to qbasic and am trying to fiqure out how to make numeric statments work cause when i use let n=(rand(1)*20)+1 for a simple game as a random timer and then use if g<>n then 300 g being a number that a user inputs and n being number it won't work and qbasic (which i have 1.1) says i have a type mismatch error could eney of ya help me
I don't know what you are trying to do, but...the function you want is RND. RND returns a floating point number in the range 0 to 1.

doing RND(1) will return an error because there is no operator between RND and what follows.

If you want to get a random number in the range 0 to 10, use something like
t = RND * 10

HTH
or INT(RND * 10) + 1 Big Grin