HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hmm how many elseif's can I put inside a if statement?

09-10-2006, 02:02 AM#1
Fr0zenLord
How many elseif's can I put inside a if statement e.g
if udg_a==10 then
"Blah"Blah"
elseif udg_a==15 then
"blalbasf"
elseif udg_a==20 then
"balaaaaajrg"
elseif udg_a==25 then
"blaaa"
On and on and on, (say even 1000 times?)

endif
endfunction?

How many tims can I fit elseif into one statement 0_0?
09-10-2006, 02:12 AM#2
Rising_Dusk
As many as you want with limits.
The limit being don't go over execution limit.

I highly doubt you'd be able to go over it with just elseifs though, I can't imagine anything that'd need more than like 20.
09-10-2006, 02:20 AM#3
PipeDream
I think there's a limit of 26 or something (yeah, ???). In general that's probably a difficult way to write.. imagine trying to change something for each case.
With 10/15/20 like that you can make your if/else's go deep by splitting an interval in half successively. That's still kind of messy though, the best way is to let the data do the driving. Divide by five and index into an array to use that information, perhaps by executing a trigger.
09-10-2006, 02:22 AM#4
shadow1500
Quote:
I think there's a limit of 26 or something (yeah, ???).
I have ~50 elseifs and it works fine.
09-10-2006, 02:58 AM#5
DioD
make a loop

loop
exitwhen false
if true then
set var + 1
endif
endloop

This will end with maximum if else number


exitwhen false useless string.

this will same like

if true then
set var + 1
endif

if true then
set var + 1
endif

if true then
set var + 1
endif

if true then
set var + 1
endif
09-11-2006, 06:45 AM#6
PitzerMike
Quote:
Originally Posted by shadow1500
I have ~50 elseifs and it works fine.

The limit used to be 28 but it was fixed by Blizzard a while ago.
Back then the compiler would throw an error when you used more elseifs.
09-11-2006, 11:56 AM#7
Toadcop
i have 32 and have no problemms but the performance get lower....