Structs, a constant, and lending one out to be changed.
lockers.zg
# Lockers with owners and items: structs, a constant, and lending one out to be changed.pubconst'capacity':=12;structLocker{immutnumber:int32,owner:str.utf8,items:list[str.utf8]}fnfree_slots[lent'l':Locker]->int32{return'capacity'minuslist.length[lend'l'.items];}fnstash[lent.mut'l':Locker,'item':str.utf8]->bool{iffree_slots[lend'l']equal_to0{returnfalse;}list.append[lend.mut'l'.items,valuegive'item'];returntrue;}fnlabel[lent'l':Locker]->str.utf8{return"#"++to.stored.str.utf8['l'.number]++" ("++'l'.owner++")";}MAIN{let'mine':=Locker[number=7,owner="Tankun",items=list.empty];let'names':=["helmet","gloves","rope"];letmut'stored':int32=0;for'n'inlend'names'{ifstash[lend.mut'mine',copy'n']{change'stored'='stored'plus1;}}std::print.useful[label[lend'mine'],": ",'stored'," stored, ",free_slots[lend'mine']," free",newln];for'i'from1tolist.length[lend'mine'.items]by1{checkstd::print.useful['i',". ",'mine'.items[pos'i'],newln];}let'x':bin64=0.1;std::print.stored['x',newln];std::print.useful['x',newln];let'tag':=give'mine'.owner;std::print.stored['tag',newln];}