radon-project / radon

The Radon Programming Language
https://radon-project.github.io
GNU General Public License v3.0
21 stars 2 forks source link

Value passing issue with `...` in functions and methods. #156

Closed Almas-Ali closed 1 month ago

Almas-Ali commented 1 month ago

Describe the bug I was trying to run this code but it is not behaving as expected always.

Screenshots or Code snippets

class Output {
    static fun write(...values, sep=" ", end="\n") {        
        var output = ""
        for value in values {
            output += str(value) + sep
        }
        print(output + end)
    }
}

Output.write("some", "new", "value") # output: valuesomenew
Output.write("some", "new", "value", sep="\n") # output: value new
Output.write("some", "new", "value", sep=" ", end="\n") # output: value \n \n

Additional context Something is wrong with ... operator, I think.