Women in Technology

Hear us Roar



Article:
  The Mustang Meets the Rhino: Scripting in Java 6
Subject:   A simple fault on page 2 script 2
Date:   2006-07-24 01:46:28
From:   RonaldMathies
Change:


engine.eval(
"if (age < 25){ " +
" riskFactor = 1.5;" +
"} else if (noClaims) {" +
" riskFactor = 0.75;" +
"} else {" +
" riskFactor = 1.0;" +
"}");


To:


engine.eval(
"if (age < 25){ " +
" riskFactor = 1.5;" +
"} else if (noClaims) {" +
" riskFactor = 0.75;" +
"} else {" +
" riskFactor = 1.0;" +
"}", bindings);


Or else the engine doesn't know the variables when it evaluates the script.