Returning void type from a method call

Someone on ##java asked about how to return a void value. This is a terrible question, but let’s look at it anyway, just because. Here’s some example code they asked about, translated: void foo(boolean bar) { if(bar) { return baz(); } } void baz() { // do stuff here } The intent was to call baz() as a replacement for foo()‘s execution; the one with the question didn’t include code after the if() block, but further...

2 minute(s) read