2023-10-23 20:12:43 +00:00
|
|
|
raw_data = (read 'examples/assets/seaCreatures.json')
|
|
|
|
sea_creatures = (from_json raw_data)
|
|
|
|
|
|
|
|
data = {
|
|
|
|
creatures = []
|
|
|
|
total_clams = 0
|
|
|
|
dolphin_clams = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
for creature in sea_creatures {
|
|
|
|
data.creatures += creature.name
|
|
|
|
data.total_clams += creature.clams
|
2023-10-23 21:36:11 +00:00
|
|
|
|
2023-10-23 20:12:43 +00:00
|
|
|
if creature.type == 'dolphin' {
|
|
|
|
data.dolphin_clams += creature.clams
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data
|