Why not set <code>result = []</code> before the <code>if</code> and then return result?