Let's say we have two ifs that depend on each other:
if var exists {
if var is array {
//Do stuff with var
} else {
//Resolve the problem
}
} else {
//Resolve the problem in the exact same way as above
}
//Continue execution with the assumption that var is in the appropriate state
How can I refactor this to remove the duplicated code without using gotos or functions/methods?
goto
of course! – svidgen Aug 07 '14 at 03:09if var exists && var is array
– user253751 Aug 07 '14 at 05:37var = new Object("String", 1)
– Mikayla Maki Aug 07 '14 at 22:16