如何在交互式Erlang会话中解除绑定变量? [英] How do you unbind variables in an interactive Erlang session?

查看:96
本文介绍了如何在交互式Erlang会话中解除绑定变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Erlang交互式shell中,可以将变量绑定到值。如果我想清除所有内容,从头开始,不用退出会议并开始新的会话,我该怎么办?

In the Erlang interactive shell you can bind variables to values. If I would like to clear everything and start from scratch without exiting the session and starting a new one, how do I do that?

如果我只想重新开始,使用单个变量,是否可以重新绑定?

And if I just wanted to re-use a single variable, is it possible to re-bind?

推荐答案

使用f()和f(Var) p>

Use f() and f(Var):

1> A = 1, B = 2.
2
2> f(A).
ok
3> A.
* 1: variable 'A' is unbound
4> B.
2
5> f().
ok
6> B.
* 1: variable 'B' is unbound
7>

Shell命令实际上是'c'模块中的函数:
http://www.erlang.org/doc/man/c.html

Shell commands are actually functions in the 'c' module: http://www.erlang.org/doc/man/c.html

这篇关于如何在交互式Erlang会话中解除绑定变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆