4 ms·
This is usually quite useful, actually! It happens a lot in numerical computing where you try a bunch of possible solutions and if none are found then you outpu
by LolWolf 8y ago
This is usually quite useful, actually! It happens a lot in numerical computing where you try a bunch of possible solutions and if none are found then you output some sort of "infeasibility" result, otherwise you output the result you broke at (skipping the else statement).
- contravariant 8y agoPutting the loop in its own function would solve the problem as well (allowing you to just return the output), or if that's not an option then you need to store the output anyway so you might as well just add a check 'if output is None:'.