Using the Klassbook

This book has hundreds of code snippets, most of which will have corresponding Klassbook pages. The companion book Elements of Kotlin Coroutines also contributes its snippets to the Klassbook as well.

The Klassbook has several additional features for helping you learn Kotlin.

Editing the Snippets

Each page has an “Edit” button above the code. Clicking that converts the code into a live editor, where you can make changes. It also expands the code, like the “Expand” button does, so you can work with the full snippet.

Once you have made changes, click “Run” to run the revised Kotlin code. It will take a few seconds for the Kotlin code to be “transpiled” into JavaScript and then run in your browser.

If you make a syntax error, the error messages will appear below the code, highlighted in red.

The Scratch Pad

Each page has a “Scratch Pad” button in the nav bar. Clicking that takes you to a page that just contains the code editor and “Run” button, without the rest of the content or widgets that you see on lesson pages. You can use the scratch pad for your own Kotlin experiments.

Note, though, that you are limited to 1KB of Kotlin source code in the editor. You can type in more than that, but anything longer will not run.

Navigating

You already saw how to go from this book to the Klassbook to bring up a relevant lesson. However, there are other navigation options in Klassbook itself.

Prev/Next Buttons

The nav bar has “Prev” and “Next” buttons to advance through the lessons in order. That will generally follow the order in which they appear in the book, though there will be occasional deviations.

Tags

Each lesson has one or more tags associated with it. Those appear on the side of the page. Clicking a tag will bring up a scrollable list of other lessons that have the same tag.

You can also click the “Search” button in the nav bar to bring up a list of all tags. Clicking on a tag there once again brings up a list of lessons associated with that tag.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.