blob: dc073f78fa70bd04931d3d8633864e00dd7f4fca (
plain)
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
|
item: @struct type = {
name : (this) -> std::string = "Dog kennel";
color: (this) -> std::string = "mauve";
price: (this) -> double = 3.14;
count: (this) -> int = 42;
}
main: ()->int = {
(x := 0) {
std::cout << "g(x)$g(x)$g" << "\n";
std::cout << "(x)$g(x)$g" << "\n";
std::cout << "(x)$g(x)$" << "\n";
std::cout << "(x)$(x)$" << "\n";
std::cout << "\"(x)$\"" << "\n";
std::cout << "\"(x)$" << "\n";
std::cout << "\"" << "\n";
std::cout << "" << "\n";
std::cout << "pl(ug$h" << "\n";
std::cout << "(x)$pl(ug$h" << "\n";
}
(x := item()) {
std::cout << std::left << std::setw(20) << x.name() << " color " << std::left << std::setw(10) << x.color() << " price " << std::setw(10) << std::setprecision(3) << x.price() << " in stock = " << std::boolalpha << (x.count() > 0) << "\n";
std::cout << "(x.name():20)$ color (x.color():10)$ price (x.price(): <10.2f)$ in stock = (x.count() > 0)$\n";
}
}
|