Java's scripting API provides a consistent way to embed scripting-language interpreters into a Java application. Tom McQueeney takes a look at what this means for your application and how you can put it to good use.
After hunting around, I found no simple or easy way a JavaScript or Ruby script could return early from being evaluated when the scripting code is outside of a function or method. A return statement is not allowed outside a function in JavaScript, nor is it allowed outside a method in Ruby. The only consistent language feature I found that guaranteed early script exit was for the code to throw an exception
Read the complete post: