Skip to content

Instantly share code, notes, and snippets.

@pomadchin
Created March 2, 2025 23:34
Show Gist options
  • Save pomadchin/c52e21249ad112ad16d4124c3454a9e0 to your computer and use it in GitHub Desktop.
Save pomadchin/c52e21249ad112ad16d4124c3454a9e0 to your computer and use it in GitHub Desktop.
object CforInline:
inline def cfor[A](init: => A)(test: => A => Boolean, next: => A => A)(body: => A => Unit): Unit =
cforInline(init, test, next, body)
inline def cforInline[R](inline init: R, inline test: R => Boolean, inline next: R => R, inline body: R => Unit): Unit =
var index = init
while test(index) do
body(index)
index = next(index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment