Scala unit type, Fibonacci recusive depth function
问题 So I want to write a Fibonacci function in scala that outputs a tree like so: fib(3) | fib(2) | | fib(1) | | = 1 | | fib(0) | | = 0 | = 1 | fib(1) | = 1 = 2 and my current code is as follows: var depth: Int = 0 def depthFibonacci(n:Int, depth: Int): Int={ def fibonnaciTailRec(t: Int,i: Int, j: Int): Int = { println(("| " * depth) + "fib(" + t + ")") if (t==0) { println(("| " * depth) + "=" + j) return j } else if (t==1) { println (("| " * depth) + "=" + i) return i } else { depthFibonacci(t-1