1. ## Recursion question

today i finished the last exercise on functions, it was about writting a prog that takes 2 numbers, and gives u the power, u had to do this using recursion. after i finished it i went back to check the answer and tested the answer the book had, well i have to say that i was disappointed.

they only tested for 1 base case when in a prog like this u have to test for 2 correct?
Code:
```{
if (power == 1)
return n;
{
if (power ==0)
return 1;
else
return (n * PowerFunc(n,power -1));
}```
they were only testing for

Code:
```if (power == 1)
return n;```
so would u say that their answer was incomplete?
another question, recursion function do they always have 2 base cases? should i email them to correct it? eheh

2. today i finished the last exercise on functions, it was about writting a prog that takes 2 numbers, and gives u the power, u had to do this using recursion. after i finished it i went back to check the answer and tested the answer the book had, well i have to say that i was disappointed.

they only tested for 1 base case when in a prog like this u have to test for 2 correct?
I think the book is ok. Your code won't work for negative numbers either.

Recursive functions won't always have two base cases. In fact, you could write your code as
Code:
```      if (power ==0)
return 1;
else
return (n * PowerFunc(n,power -1));```

3. u stand correct on the negative numbers but i still think that this prog requires 2 base cases,
2^ 1 =2
2^0=1
2 ^ 2 = 4

so if u dont test for (power ==1 ) then ull get 1 when u suppose to get n correct?

4. nm lol i figured it out, the function calls itself, its recursion. lol