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 / IF...THEN question

Author
Message
Link
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location:
Posted: 10th Mar 2003 21:46
I also have a question about logic in if statements.

I was trying to get valid a valid number from an input statement.

Do
' Do some stuff
INPUT "What display mode would you like to select? (1-99, 0 for quit): "; number

IF number = 0 THEN Exit
IF number > 1 AND number 1 AND number
Attreid
22
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 10th Mar 2003 21:51
we cannot see all your code ( write it between [ code ] and [/ code ] )
but ..
try it :



I'm the God who made the world in seven lines.
I'm the Evil who destroyed this world in one line.
Link
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location:
Posted: 10th Mar 2003 21:56
I also have a question about logic in if statements.

I was trying to get valid a valid number from an input statement.



However, I get an IF..THEN Construct ERROR, at "IF number > 1 AND number < 99 THEN". What am I doing wrong? Any pointers or tips?

What I am tryin to do is figure out if the input is a 0 first so it will exit the loop. Then figure out if the number is between 1 and 99, and if it is do some other stuff.

Thanks again!

Link
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location:
Posted: 10th Mar 2003 22:01
Thanks Attreid!

Not sure what happened before. Anyway, this just one of the most basic of questions. I noticed that it does help when you can see all of the code and the post. I already used



to get the display modes
then that code that I wrote above.

Should I use Nested IF...THEN Statements?

Oraculaca
21
Years of Service
User Offline
Joined: 6th Jan 2003
Location: Scotland
Posted: 10th Mar 2003 23:03
I think if you are putting a THEN in your if statment then you neednt put an ENDIF because all your data should come after the THEN
eg:
IF X>1 THEN X=0
as opposed to:
IF X>1
X=0
ENDIF

Not-Mr-Thumpy wrinkled his nose, it was suddenly hard to concentrate
Link
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location:
Posted: 10th Mar 2003 23:44
Yes that was it. I really appreciate the help. I know sometimes questions can be lame, but they really do help! Thanks Cut_Me_Own_Throat_Dibbler!

I am new to Dark Basic, but familiar with Programming in other languages.

Oraculaca
21
Years of Service
User Offline
Joined: 6th Jan 2003
Location: Scotland
Posted: 11th Mar 2003 00:22
No probs .
glad I could help

Not-Mr-Thumpy wrinkled his nose, it was suddenly hard to concentrate

Login to post a reply

Server time is: 2024-11-27 23:37:59
Your offset time is: 2024-11-27 23:37:59