Mercurial > hg > octave-nkf
annotate test/test_recursion.m @ 6210:12b676a0b183 before-graphics-branch
[project @ 2006-12-07 02:37:17 by jwe]
author | jwe |
---|---|
date | Thu, 07 Dec 2006 02:37:17 +0000 |
parents | 1ad66ea35fe5 |
children | 93c65f2a5668 |
rev | line source |
---|---|
5590 | 1 %% Automatically generated from DejaGNU files |
2 | |
3 %% test/octave.test/recursion/recursion-1.m | |
4 %!function y = f (x) | |
5 %! if (x == 1) | |
6 %! y = x; | |
7 %! return; | |
8 %! else | |
9 %! y = x * f (x-1); | |
10 %! endif | |
11 %!test | |
12 %! assert(f (5),120); | |
13 | |
14 %% test/octave.test/recursion/recursion-2.m | |
15 %!function y = f (x) | |
16 %! if (x == 1) | |
17 %! y = x; | |
18 %! return; | |
19 %! else | |
20 %! y = f (x-1) * x; | |
21 %! endif | |
22 %!test | |
23 %! assert(f (5),120); | |
24 |