A return statement just stops the execution of its respective method immediately and returns the value it was assigned. So yes the first example would work just fine
NOTE: the second example is more readable than the first one because only one return statement is being used.