#include class Thing: object desc() { ldesc; inherited(); } ldesc = "" ; enum small, medium, large, gigantic; class Sizable: object desc() { "It appears to be <>small<>medium<>large<< else if size == gigantic>>gigantic<> in size. "; inherited(); } size = medium ; class Openable: object desc() { "The <> is <>open<>closed<>. "; inherited(); } isOpen = true size = medium ; class Moistenable: object desc() { "<>It appears to be a bit damp. "; inherited(); } isMoist = nil ; box: Thing, Sizable, Openable, Moistenable name = 'box' ldesc = "It's a brown cardboard box. " isOpen = true size = large isMoist = true ; cabinet: Thing, Sizable, Openable, Moistenable name = 'cabinet' ldesc = "It's a large oak cabinet. " isOpen = nil ; oven: Thing name = 'oven' desc = "The oven door is <>open<> and the light inside is on<><>closed<>. " isOpen = nil isLit = nil test(o, l) { isOpen = o; isLit = l; desc; "\n"; } ; main(args) { box.desc(); "\b"; cabinet.desc(); "\b"; for (local i in 1..10) "\*Nested if with i=<>: <><>i is less than 3<>i is at least 3 but less than 5<> i is 5-7<>i is greater than 7<>\n"; "\b"; for (local i in 10..100 step 10) { local s = 'i=<>, which is <>less than fifty<>at least fifty, but less than seventy<>seventy and up'; "<>\n"; } "\b"; oven.test(nil, nil); oven.test(nil, true); oven.test(true, nil); oven.test(true, true); "\b"; local a = 5; """This is an "unless" test. <>'a' is not less than 3. <>< 3>>'a' is not greater than 3."""; "\b"; """Second "unless" test. <>'a' is not less than 7."""; "\b"; """Third "unless" test. <>'a' is not less than 3."""; "\b"; local s = '''Another "unless" test. < 3>>'a' is not greater than 3.< 7>>'a' is more than 7. < 6>>'a' is less than 6. '''; "<>"; // test from example in doc "\b"; { local i = 3, j = 'boo'; local s = 'The value of i is <>, and j is <>!'; "s is: <>\n"; i = 7; j = 'boo hoo'; "s is now: <>\n"; } // another doc example "\b"; { local i = 3, j = 'boo'; local s = {: 'The value of i is <>, and j is <>!'}; "s is: <>\n"; i = 7; j = 'boo hoo'; "s is now: <>\n"; } "\n"; }