Tech
03/16/2023, 12:22 AMif(true) run {
val example = null
if(example == null) {
return@run
}
}
if(true) run {
return@run
}
igor.wojda
03/16/2023, 9:31 AMval example = null ?: return@run
Tech
03/16/2023, 7:37 PMfun example(): List<String> {
val conf = /* load configuration */
if(conf.isSet("team_spawnpoint")) {
val section = conf.getSection("team_spawnpoint.spawns")
?: return@run
}
if(conf.isSet("all_spawnpoint")) {
val section = conf.getSection("all_spawnpoint.spawns")
?: return@run
}
return /*list of all valid spawn points*/
}
Something like this where my function can possibly load spawn points for a specific team and can also load spawn points for people unassigned to a team, if the section in the configuration doesn't exist I'd like to just break out of the if clause.