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!if var exists && var is array