aeonsky Posted November 14, 2008 Share Posted November 14, 2008 Hello, here is the little piece of code... if(i == portfolio.length){ portfolio = expand(portfolio); portfolio[portfolio.length-1] = temp; return; } else { return; } I think I saw this in other programming languages, that if you don't have anything after the return statement, it returns the last expression. However, I do not know what the return statement which is after the else statement returns. Thanks for the help! Link to comment https://forums.phpfreaks.com/topic/132759-java-return/ Share on other sites More sharing options...
foxtrotwhiskey Posted November 14, 2008 Share Posted November 14, 2008 Its not returning anything at all, neither of them are. The function should be declared as void. if you want them to return something, you must put it after the return statement. Link to comment https://forums.phpfreaks.com/topic/132759-java-return/#findComment-690409 Share on other sites More sharing options...
aeonsky Posted November 14, 2008 Author Share Posted November 14, 2008 Sorry, the method was actually void. It is true, the method is not supposed to return anything. I just stupidly mixed it up with a Ruby feature (where return statement can return the last expression). Thank you! Link to comment https://forums.phpfreaks.com/topic/132759-java-return/#findComment-690428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.