knowyourtables.groovy

来自「大名鼎鼎的java动态脚本语言。已经通过了sun的认证」· GROOVY 代码 · 共 17 行

GROOVY
17
字号
/**  * Simple mathematics quiz * @author: Jeremy Rayner * based on algorithms from INPUT/Marshall Cavendish/1984 */while (true) {    try {        def n = (int)(Math.random() * 12) + 1        println "What is $n times 9?"        def a = System.in.readLine().toInteger()        if (a == n * 9) println "Correct"                  } catch (Exception e) {        println "The computer didn't understand your input"    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?