-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ion
More file actions
28 lines (25 loc) · 737 Bytes
/
Copy pathmain.ion
File metadata and controls
28 lines (25 loc) · 737 Bytes
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
import "catalog.ion" as catalog;
import "stdlib/fmt.ion" as fmt;
import "stdlib/io.ion" as io;
fn main() -> int {
let lines: int = catalog::catalog_line_count();
let units: int = catalog::catalog_units_in_stock();
let total: int = catalog::catalog_grand_total();
io::println(String::from("catalog report"));
io::print(String::from("lines: "));
io::println(fmt::int_to_string(lines));
io::print(String::from("units: "));
io::println(fmt::int_to_string(units));
io::print(String::from("total cents: "));
io::println(fmt::int_to_string(total));
if lines != 3 {
return 1;
}
if units != 17 {
return 2;
}
if total != 5140 {
return 3;
}
return 0;
}