if/else Statements
For the purposes of your bounty board, the player’s strength is determined by their playerLevel, which you created in the previous chapter. Lower values indicate that the hero is closer to the beginning of their epic journey, and higher values indicate that a hero has gained experience and has become stronger.
Your goal is to present quests based on the player’s current level. For example, if a player is at level 1 (the starting point for new characters), then they need to be given an easy quest, like a tutorial.
Within the main function, write your first if/else statement, as shown below.
We will break down this new code after you enter it.
Listing 3.1 Printing the player’s quest (Main.kt)
const val HERO_NAME ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access