Today, with the help of Java, we take a light hearted look at an important topic pertaining to our religious faith in Christ: Temptation. No need to talk much, the code speaks for itself.
Christian frank = Christians.findByFirstAndLast("Frank", "Adams");
List<Temptation> temptations = Devil.getTempations();
boolean succeeded = false;
for(Tempation t: tempations) {
succeeded = t.tryOn( frank );
if( succeeded ) {
Devil.celebrate();
}
}
if( succeeded == false ) {
MaturityLevel maturityLevel = frank.getMaturityLevel();
if( maturityLevel.getDescription().equals("baby") ) {
Devil.setNextTrialFor(frank, Period.getInstance("D3") ); // next 3 days
}
else if( maturityLevel.getDescription().equals("adult") ) {
Devil.setNextTrailFor(frank, Period.getInstance("I60") ); // next 60 seconds. We need to try harder
}
}
That’s all class. Anyone wanna do that code in Javascript? Might provide a bit more syntactic sugar :). Have a blessed day!!!