one more question, how do I make a function that r...
# getting-started
h
one more question, how do I make a function that returns nothing without throwing an Exception?
a
Nothing indicates that it essentially halts the program. You can throw an exception or call system exit. I believe there is a kotlin function called exit that returns nothing, doing exactly that If you are referring to Java's void, then return unit (you don't have to specify that in the method header)
h
i want the formet. to exit. but i don’t want the program to exit. i just want to simulate an exception without throwing an exception (so only that thread stops). so like if im making a discord bot, it stops the program there, not everywehre
k
If you throw an exception and no one catches it only that thread stops.
o
Ok so, just as an idea you can suspend execution and never resume it i.e. try to apply coroutines
a
If you want, you can also use boolean returns to propagate responses. As in return true to continue, false otherwise etc
h
Alan thanks for the great idea!