New topic: 

How do I wrap IF THEN conditions when the list is long?

<http://forums.realsoftware.com/viewtopic.php?t=26354>

       Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic         Author  
Message       n7tdt           Post subject: How do I wrap IF THEN conditions 
when the list is long?Posted: Sat Feb 07, 2009 10:02 am                        
Joined: Mon Jan 19, 2009 2:46 pm
Posts: 8              I'm still getting familiar with the syntax of the RB 
environment.  Looking at code examples is always helpful.  One thing I haven't 
been able to figure out is how to structure my IF THEN conditions on individual 
lines. For example, this doesn't work for me:

Code:
IF
stMortRequired12.Visible = True OR
stMortRequired8.Visible = True OR
stMortRequired7.Visible = True OR
stMortRequired6.Visible = True OR
stMortRequired9.Visible = True OR
THEN
g_bMortRequiredFieldsCompleted = False
ELSE
g_bMortRequiredFieldsCompleted = True
END IF



(In my actual code everything but the IF THEN ELSE END IF is indented.)

I like to structure my code that way for readability.  I'm having to put all of 
those OR conditions on the same line as the "IF". Scrolls right off the screen 
and is tough to read.  I actually have about 20 more of these OR conditions 
that I test in the live code so it's a pretty long condition line.

While there may be a much more efficient method to accomplish what I'm doing 
here... in this question I simply want to know if there is a way to structure 
an IF THEN statement similar to how I did above.

Thanks!   
                            Top                ChickenScratch           Post 
subject: Re: How do I wrap IF THEN conditions when the list is long?Posted: Sat 
Feb 07, 2009 10:22 am                        
Joined: Fri Feb 15, 2008 5:14 pm
Posts: 24              _ (underscore)   
                            Top               Kyan           Post subject: Re: 
How do I wrap IF THEN conditions when the list is long?Posted: Sat Feb 07, 2009 
10:37 am                        
Joined: Tue Aug 14, 2007 8:44 am
Posts: 216              Like this? –
Code:IF stMortRequired12.Visible = True OR_
stMortRequired8.Visible = True OR_
stMortRequired7.Visible = True OR_
stMortRequired6.Visible = True OR_
stMortRequired9.Visible = True OR_
THEN
g_bMortRequiredFieldsCompleted = False
ELSE
g_bMortRequiredFieldsCompleted = True
END IF
     
_________________
RB 2007 r5 Standard Release.  
                            Top               ChickenScratch           Post 
subject: Re: How do I wrap IF THEN conditions when the list is long?Posted: Sat 
Feb 07, 2009 10:43 am                        
Joined: Fri Feb 15, 2008 5:14 pm
Posts: 24              or _   
                            Top               n7tdt           Post subject: Re: 
How do I wrap IF THEN conditions when the list is long?Posted: Sat Feb 07, 2009 
10:55 am                        
Joined: Mon Jan 19, 2009 2:46 pm
Posts: 8              ChickenScratch wrote:_ (underscore)

That worked perfectly.  Thanks.

Code:
if _
  stMortRequired12.Visible=True OR _
  stMortRequired8.Visible=True OR _
  stMortRequired7.Visible=True OR _
  stMortRequired6.Visible=True OR _
  stMortRequired9.Visible=True OR _
  stMortRequired10.Visible=True OR _
  stMortRequired11.Visible= True  OR _
  stMortRequired2.Visible = TRUE THEN
  g_bMortRequiredFieldsCompleted = False
else
  g_bMortRequiredFieldsCompleted = True
end if

   
                            Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]     
-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to