File: 2-function-recursion.turtle

package info (click to toggle)
kturtle 4%3A25.04.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,392 kB
  • sloc: cpp: 7,717; ruby: 2,217; xml: 243; makefile: 3; sh: 3
file content (23 lines) | stat: -rw-r--r-- 247 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
kturtle-script-v1.0
@(learn) a $n {
  $n = $n - 2
  @(fw) 10
  @(print) "a: " + $n
	@(if) $n <= 0 {
    @(return)
	}
  b $n
}

@(learn) b $n {
  $n = $n - 1
  @(fw) 10
  @(print) "b: " + $n
	@(if) $n <= 0 {
    @(return)
	}
  a $n
}

@(reset)
a 20