workflow { "init" { ctx -> ctx.nombreMysterieux = new Random().nextInt(100) ctx.nb = 0 "input" } "input" { ctx -> println "Veuillez saisir un nombre." def n = System.console().readLine().toInteger() ctx.nb++ if (n == ctx.nombreMysterieux) return "success" println n > ctx.nombreMysterieux ? "Trop grand !" : "Trop petit !" "input" } "success" { ctx -> println "Gagné en ${ctx.nb} coup(s) ! " } }