Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help me!
#1
Ok..This is a newbie question but im stuck and really need help fast and now.
Ok. Heres the problem:
Say if one condition is fulfilled, i want multiple results like:
IF number > 1 THEN LET abc = 3 "AND" qwe = 5

The "AND" is just an example but u should get my point.

I wanna know how to do this???!!!
Reply
#2
U mean like this...?


Code:
If number > 1 then
   abc = 3
   qwe = 2
   print "hello world"
end if
Reply
#3
that works ??

dont you have to put a " ; " or a "," or sumthin ??
Reply
#4
ok i found it..
you have to put it somethin like this :

Code:
CLS
IF number > 1 then let abc = 3 : let qwe = 5
END

but yea, what you said is right too 8) 8)
Reply
#5
a colon is the closest thing to the semicolon in c-based languages. It conjoins lines, but since IF doesnt close brackets, it's dangerous to use it. And since QB ends every line by line break, it's not necessary.

Use a multi-line if/then statement, like described above

lookie here for reference:
http://qbasicnews.com/qboho/qckif.shtml
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#6
my program involves at least 100-200 if statements and makin a multiline if then for all would be crazy !!!!
Reply
#7
Quote:my program involves at least 100-200 if statements and makin a multiline if then for all would be crazy !!!!
you're kidding right?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#8
no,lol, im serious
Reply
#9
Quote:my program involves at least 100-200 if statements and makin a multiline if then for all would be crazy !!!!

not crazy at all. Block "If/then/elseif/endif" is the best way. they can be nested, as long as you keep track of which endif goes with which if. Your other option, if you want to branch in multiple directions, is to use the "select case/case x/case y/case else/end select" form. you can, again, execute blocks with each case statement.

what are you doing that requires so many ifs? There may be an easier way.
Reply
#10
Quote:
Janesh Wrote:my program involves at least 100-200 if statements and makin a multiline if then for all would be crazy !!!!

not crazy at all. Block "If/then/elseif/endif" is the best way. they can be nested, as long as you keep track of wcich endif goes with which if. Your other option, if you want to branch in multiple directions, is to use the "select case/case x/case y/case else/end select" form. you can, again, execute blocks with each case statement.

what are you doing that requires so many ifs? There may be an easier way.
JANESH,
Based on what you say, Mango's suggestion to use SELECT CASE and multiple CASE statements, is probably the best.

You say you have 100-200 conditions. Are they all based on the same variable? Tell us a little about what you're doing, there might be a simpler way of doing it.
*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)