diff --git a/docs/tutorials/src/02_hello_world.md b/docs/tutorials/src/02_hello_world.md index 3f927f63a..6a1e1f13b 100644 --- a/docs/tutorials/src/02_hello_world.md +++ b/docs/tutorials/src/02_hello_world.md @@ -94,9 +94,11 @@ need to create a world in which to store all of our components. ```rust,ignore use specs::{World, WorldExt, Builder}; -let mut world = World::new(); -world.register::(); -world.register::(); +fn the_world(){ + let mut world = World::new(); + world.register::(); + world.register::(); +} ``` This will create component storages for `Position`s and `Velocity`s. @@ -173,9 +175,11 @@ them. To execute the system, you can use `RunNow` like this: ```rust,ignore use specs::RunNow; -let mut hello_world = HelloWorld; -hello_world.run_now(&world); -world.maintain(); +fn run_the_system() { + let mut hello_world = HelloWorld; + hello_world.run_now(&world); + world.maintain(); +} ``` The `world.maintain()` is not completely necessary here. Calling maintain should be done in general, however.