Last active
March 21, 2019 17:30
-
-
Save mdevaev/8177a0b6ecad35ff7753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func uint32 main(str[] argv): | |
keyval<unt32:str> kv; | |
for uint32 i = 0; i < 10; i++: | |
kv.append("Number: {}".fmt(i)) | |
for (uint32 k, str v) in kv.items(): | |
print(k, v) | |
return 0 | |
// ----- | |
class MyList(list): pass | |
func print_list(like list<like object> l): | |
for i in l: | |
print(l) | |
func uint32 main (str[] argv): | |
list<str> strings = ["aaa", "bbb", "ccc"] | |
MyList<uint32> ints = [1, 2, 3] | |
print_list(strings) | |
print_list(ints) | |
// ----- | |
import io | |
func main(str[] argv) -> uint32: | |
dict[uint32, str] kv; | |
for uint32 i = 0; i < 10; ++i: | |
kv[i] = "Number: {}".fmt(i) | |
for (uint32 k, str v) in kv.items(): | |
io.print(k, v) | |
list[tuple[uint32, str]] lst = kv.items() | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment