ctfe4
auto ctfe4 =
q{--- ctfe4
// control flow
i32 sign(i32 number) {
i32 result;
if (number < 0) result = -1;
else if (number > 0) result = 1;
else result = 0;
return result;
}
enum i32 val0 = sign(-1); // CTFE
enum i32 val1 = sign( 0); // CTFE
enum i32 val2 = sign( 1); // CTFE
i32 get_val0() { return val0; } // -1
i32 get_val1() { return val1; } // 0
i32 get_val2() { return val2; } // 1
};
tests ctfe
functionsvariables