OmniTrader Professional Forum - OmniLanguage Discussion
End Do statement?

^ Top
kmcintyre

Posts: 132

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
 
Subject : End Do statement?
Posted : 6/23/2018 7:18 PM
Post #30089

dim iPigs as integer
iPigs = 5
Do While iPigs > 0
if iPigs = iPigsFlyingLimit then
end Do
else
iPigs = iPigs - 1
end if
Loop

Why does the OL compiler barf on this? The End Do
statement appears to be the issue. But why?

Is there another way to break out of a Do loop?

Also, End While doesn't seem to be supported.

help with iteration please...

^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: End Do statement?
Posted : 6/23/2018 7:55 PM
Post #30090 - In reply to #30089

Two things

PigsFlyingLimit is not defined

Although I rarely use Do While, as I recall the proper exit is End Loop

I trust you realize the logic is redundant ... it would be tighter if PigsFlyingLimit was defined ahead of time and that was part of the Do While .. you wouldn't need the test inside the loop

Do While iPigs > 0 and iPigs <> iPigsFlyingLimit
iPigs = iPigs - 1
Loop
^ Top
kmcintyre

Posts: 132

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: End Do statement?
Posted : 6/23/2018 11:11 PM
Post #30091 - In reply to #30090

The pigs flying example was simply to show the construct I was working with.

After working with the End Do statement actually compiled ok.

Thanks for the help!



https://www.omnitrader.com/currentclients/proforum/thread-view.asp?threadid=7607&posts=3