go.starlark.net@v0.0.0-20231101134539-556fd59b42f6/starlark/testdata/recursion.star (about)

     1  # Tests of Starlark recursion and while statement.
     2  
     3  # This is a "chunked" file: each "---" effectively starts a new file.
     4  
     5  # option:recursion
     6  
     7  load("assert.star", "assert")
     8  
     9  def fib(n):
    10  	if n <= 1:
    11  		return 1
    12  	return fib(n-1) + fib(n-2)
    13  
    14  assert.eq(fib(5), 8)