M
Modular16mo ago
Helehex

Pass variadic arguments or parameters?

Is there a way to do this currently?
from utils.list import VariadicList

fn func1(*a: Int):
let l: VariadicList[Int] = VariadicList[Int](a)
for i in range(len(l)): print(l[i])

fn func2(*a: Int):
func1(a)

func1(4,5,6,7,1,1)
from utils.list import VariadicList

fn func1(*a: Int):
let l: VariadicList[Int] = VariadicList[Int](a)
for i in range(len(l)): print(l[i])

fn func2(*a: Int):
func1(a)

func1(4,5,6,7,1,1)
1 Reply
czheo
czheo16mo ago
fn func1(l: VariadicList[Int]):
for i in range(len(l)): print(l[i])

fn func1(*a: Int):
func1(a)

fn func2(*a: Int):
func1(a)

fn main():
func1(1, 2)
func2(1, 2, 3)
fn func1(l: VariadicList[Int]):
for i in range(len(l)): print(l[i])

fn func1(*a: Int):
func1(a)

fn func2(*a: Int):
func1(a)

fn main():
func1(1, 2)
func2(1, 2, 3)
Want results from more Discord servers?
Add your server