- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Suppose I've got several functions which all have the same locals and outer loop, but each function has a completely different inner loop.
Consider these two functions:
So basically all the locals and outer structure is the same, but the inner calls of the loop change between functions. Is there anyway I can generalize this at all to make the code more elegant (e.g. a textmacro?).
Suppose I've got several functions which all have the same locals and outer loop, but each function has a completely different inner loop.
Consider these two functions:
JASS:
function foo takes nothing returns boolean
local integer i = 0
local integer maxIterations
local integer x
local integer y
local integer z
loop
exitwhen i == maxIterations
//specific code here
set i = i + 1
endloop
endfunction
function bar takes nothing returns boolean
local integer i = 0
local integer maxIterations
local integer x
local integer y
local integer z
loop
exitwhen i == maxIterations
//specific code here
set i = i + 1
endloop
endfunction
So basically all the locals and outer structure is the same, but the inner calls of the loop change between functions. Is there anyway I can generalize this at all to make the code more elegant (e.g. a textmacro?).