mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 08:24:05 +02:00
34 lines
512 B
Plaintext
34 lines
512 B
Plaintext
|
|
fn main() -> int {
|
|
let i = 0;
|
|
|
|
while i < 10 {
|
|
print_int(factorial(i));
|
|
println("Hello\ world");
|
|
|
|
i = i + 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
fn factorial(v: int) -> int {
|
|
if v == 0 {
|
|
return 1;
|
|
}
|
|
return v * factorial(v - 1);
|
|
}
|
|
|
|
#[c_function("println")]
|
|
fn println(value: *str) -> int {}
|
|
#[c_function("print_int")]
|
|
fn print_int(value: int) -> int {}
|
|
|
|
#[c_export("sbc_main")]
|
|
fn sbc_main() -> int {
|
|
main();
|
|
return 0;
|
|
}
|
|
|
|
// vim: syntax=slige commentstring=//\ %s
|
|
|