Groovy web console

subscribe to the feed Subscribe
to this
site

short circuiting

Published 3 months ago by duder
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def expensive = { -> 
  println("this is expensive")
  true
}


if (false && expensive()) {
  println("foo")
}

if (false || expensive()) {
  println("bar")
}