diff --git a/README.md b/README.md index 31c0e83ef5..b0de51ca0f 100644 --- a/README.md +++ b/README.md @@ -96,27 +96,25 @@ type model struct { } ``` -## Initialization - -Next, we’ll define our application’s initial state. `Init` can return a `Cmd` -that could perform some initial I/O. For now, we don’t need to do any I/O, so -for the command, we’ll just return `nil`, which translates to “no command.” +The model can be initialised as such: ```go func initialModel() model { - return model{ - // Our to-do list is a grocery list - choices: []string{"Buy carrots", "Buy celery", "Buy kohlrabi"}, - - // A map which indicates which choices are selected. We're using - // the map like a mathematical set. The keys refer to the indexes - // of the `choices` slice, above. - selected: make(map[int]struct{}), - } + return model{ + // Our to-do list is a grocery list + choices: []string{"Buy carrots", "Buy celery", "Buy kohlrabi"}, + + // A map which indicates which choices are selected. We're using + // the map like a mathematical set. The keys refer to the indexes + // of the `choices` slice, above. + selected: make(map[int]struct{}), + } } ``` -After that, we’ll define our application’s initial state in the `Init` method. `Init` +## Initialization + +Next, we’ll define our application’s initial state in the `Init` method. `Init` can return a `Cmd` that could perform some initial I/O. For now, we don't need to do any I/O, so for the command, we'll just return `nil`, which translates to "no command."