Update d_string example.

This commit is contained in:
Jesse Brault 2025-09-18 17:09:38 -05:00
parent 5ff14f9dea
commit 9e3d71d73b

View File

@ -1,4 +1,16 @@
class World(pub name: String, pub color: String)
pub static worlds = [
World('Mercury', 'Red'),
World('Earth', 'Blue'),
World('Jupiter', 'Orange')
]
pub static getWorld(color: String) -> String = worlds
.find { it.color == color }
.map { it.name }
.expect "No world has the given color ${color}."
end
fn main()
let world = 'Earth'
println "Hello, ${world}!"
end
println "Hello, ${World::getWorld('Blue')}!"
end