Reusing function variables in a `when` conditional

This I understand from your explanation I was just attempting to address getting the function iteraterefs to compile with inputs. I’ll worry about variable assignment after that.