aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/c/if_else.c
blob: e71aa328cafba34930c2673c718f51936b65979f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
int foo(int x){
    if (x > 10)
        return 10;

    if (x > 10)
        return 10;
    else
        return 10;

    if (x > 20)
        return 20;
    else if (x > 15)
        return 15;
    else
        return 10;
}

int bar(int x){
    if (x > 20)
        return 10;
    else {
        return 10;
    }

    if (x > 20)
        return 10;
    else if (x > 10) {
        return 10;
    }
}

int baz(int x){
    if (x > 20)
        return x;
    else if(x > 10) {
        if(x > 10) {
            if(x > 10)
                return 10;
            if(x > 5) {
                return 5;
            }
        }
    }

    if (x > 20)
        if (x > 19)
            if(x > 18)
                return x;

    if (x > 20)
        return x;
    else if (x > 19) {
        if (x > 18)
            return x;
        else
            x++;
    }
    return 0;
}