Even _if_ syntax sugar were available I would recommend the more verbose approach, simply for clarity. let matchCount = customregex() # return number of matches let hasMatches = matchCount > 0 if hasMatches: for i in 0 .. matchCount: Run
This would honestly be more elegant though if `customregex` didn't return the number of matches, but the matches themselves. What you actually want to express is to do X _per match_ , right? So imo what you actually seem to want is a `for _ in matches:` loop.