On August 6, 2010 at 06:17, BluPhenix said...
Ok now it's more clear.
Although I'm not really sure, but I think you don't need a return statement at the end of the function if the function doesn't actually return anything.
You can use it in a conditional script break thought:
function stoppable() {
if (sky==="blue") {
return;
} else {
doSomething;
}
This will break the execution of the function if the sky is blue.
Yeah, I do use "return" as a conditional script break quite often. That being said, I've gotten into the habit of including a "return" at the end of my functions as well as I don't really know JavaScript per se. I worked on the SlimPronto activity with Barry Gordon and all my JavaScript knowledge has been gained by studying Barry's ProntoScript. In many cases, Barry will end a function with a "return", so I'm just following that practice even though I don't recall the purpose it serves. Doesn't break anything, so I figure it's all good.
Last edited by Lowpro on August 6, 2010 11:42.