mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
parent
98c362d038
commit
d5d5561d74
12
unittests/ranged_for_2.chai
Normal file
12
unittests/ranged_for_2.chai
Normal file
@ -0,0 +1,12 @@
|
||||
def keys(map)
|
||||
{
|
||||
auto v = Vector(); // create empty vector
|
||||
for( i : map )
|
||||
{
|
||||
v.push_back(i.first); // append key to the vector
|
||||
}
|
||||
v; // return the new vector
|
||||
}
|
||||
print(keys(["1a":111, "2b":222]));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user