Читать книгу Programming Kotlin Applications - Бретт Мак-Лахлин, Brett McLaughlin - Страница 24

Create Your Kotlin Program

Оглавление

Once your project is up and running, create a new Kotlin file. Find the src/ folder in the left navigation pane, right-click that folder, and select New ➢ Kotlin File/Class (see Figure 1.5). You can enter the code from Listing 1.2, and it should look nice and pretty, as shown in Figure 1.6 (thanks IntelliJ!).

NOTE Your IDE may not be configured exactly like mine. If you don't see the src/ folder, you may need to click Project on the left side of your IDE to display the various folders, and possibly click again on the name of the project.


FIGURE 1.5 Kotlin code should go in the src/ folder.

NOTE From this point forward, code will typically not be shown in an IDE. That way, you can use the IDE of your choice (or the command line), because you should get the same results across IDEs.


FIGURE 1.6 IntelliJ automatically formats code and adds sensible syntax highlighting.

Programming Kotlin Applications

Подняться наверх