Skip to content

Instantly share code, notes, and snippets.

@andiogenes
Created July 12, 2024 04:04
Show Gist options
  • Save andiogenes/a0c615088b774702acf4b8f562fbe2df to your computer and use it in GitHub Desktop.
Save andiogenes/a0c615088b774702acf4b8f562fbe2df to your computer and use it in GitHub Desktop.
Recursive inline in Scala 3
inline def unroll(inline times: Int)(inline action: Int => Unit): Unit =
if (times > 0)
action(times)
unroll(times - 1)(action)
unroll(4)(println)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment