Groovy web console

subscribe to the feed Subscribe
to this
site
Not a puzzler (via #groovywebconsole)
tweet this snippet Tweet
this
script

Not a puzzler

Published 1 month ago by jbaruch
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class QuizFeedback {
    def isCorrect() {
        false
    }
}

def quizFeedback = new QuizFeedback()

Boolean isCorrect = quizFeedback.isCorrect()

println isCorrect

int i = quizFeedback.isCorrect() ? 1 : 0

println i

if (i == 1) {
    println 'This should never happen'
} else {
    println 'This is fine'
}