how can i implement recursion without creating a v...
# announcements
s
how can i implement recursion without creating a variable via
val
or
var
and without creating a function via
fun
the closest i can get is a lambda expression
{ println("this is inside lambda") }
but i am unable to assign a lable to it
k
Write code to handle the stack yourself.
s
that REQUIRES creating variables -_-
k
You don't want variables and you don't want functions? So no code then?
s
nope cus i literally CANNOT create them
k
Another XY problem?
s
Copy code
> Could not set unknown property 'val0' for task ':pack' of type org.gradle.api.DefaultTask.

    val val0 = 0
Copy code
> Could not set unknown property 'var0' for task ':pack' of type org.gradle.api.DefaultTask.

    var var0 = 0
Copy code
> Could not find method a() for arguments [pack_6jwbnzhp0j5onxijf2qveb5gr$_run_closure1$_closure2@7cc6bdd3] on task ':pack' of type org.gradle.api.DefaultTask.

    fun a() {}
    a()
k
#C19FD9681
I'm sure you can have variables in Kotlin gradle scripts...
n
you sure thats in a .gradle.kts file ? not just groovy gradle file ?
s
its in
./pack.kts
which according to
IntelliJ
, is perfectly valid for a
Kotlin Script
ok, so i can KIND OF create a function like... loop with
Copy code
for (p in [""]) {
        p = ["hello", "hi"]
        for (x in 1..2) {
            for (y in p) {
                println("x = $x, y equals $y")
            }
            p = ["boo"]
        }
    }
but i have no idea if this can actually be useful
k
I'd try to solve the real problem instead of looking for weird workarounds.
👌 4
s
ok x.x