Debian Codegraph @

src/test/06-Errors/error-return-not-all-3.ck

raw
1 // all control paths return, multi-level if/else
2
3 fun float foo( int a, int b )
4 {
5 if( a == 1 )
6 {
7 if( b == 1 )
8 {
9 return 1;
10 }
11 else
12 {
13 return 2;
14 }
15 }
16 else if( a == 2 )
17 {
18 if( b == 1 )
19 {
20 // commenting this out leads to not all
21 // control paths returning a value
22 // return 3;
23 }
24 else
25 {
26 return 4;
27 }
28 }
29 else
30 {
31 if( b == 1 )
32 {
33 return 5;
34 }
35 else
36 {
37 return 5;
38 }
39 }
40 }
41
42 <<< foo( 2, 1 ) >>>;