【问题标题】:How to clear all variables in Scala REPL如何清除 Scala REPL 中的所有变量
【发布时间】:2012-12-26 20:35:59
【问题描述】:

有快捷指令吗?每次我想清除所有变量时,我都不想Ctrl+d 并运行 Scala。 reset、clear 和 clean 不起作用,:help 没有列出任何内容

【问题讨论】:

    标签: scala read-eval-print-loop


    【解决方案1】:

    您可以使用:reset

    Welcome to Scala version 2.10.0-RC2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> val a = 1
    a: Int = 1
    
    scala> val b = 3
    b: Int = 3
    
    scala> :reset
    Resetting interpreter state.
    Forgetting this session history:
    
    val a = 1
    val b = 3
    
    Forgetting all expression results and named terms: $intp, a, b
    
    scala>
    

    【讨论】:

    • 谢谢!我刚刚意识到我正在使用 scala 2.9.2,知道我可以在那里使用什么吗? :reset 不起作用
    猜你喜欢
    • 1970-01-01
    • 2011-04-02
    • 1970-01-01
    • 2012-11-12
    • 2014-05-20
    • 1970-01-01
    • 1970-01-01
    • 2015-07-04
    • 1970-01-01
    相关资源
    最近更新 更多