Skip to content

Commit

Permalink
Clarify view example
Browse files Browse the repository at this point in the history
  • Loading branch information
wwfranczyk committed Sep 7, 2021
1 parent 18c55c6 commit 392a162
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ func main() {

// Use Each to iterate all entities with required components
view.Each(func(entity *ento.Entity) {
var c *Component1
entity.Get(&c)
var c1 *Component1
var c2 *Component2
entity.Get(&c1, &c2)

// No need to check for nil
println(c.value)
println(c1.value, c2.value)
})
}

0 comments on commit 392a162

Please sign in to comment.