History variables: Difference between revisions

no edit summary
No edit summary
Line 335:
2013-Jan-19 23:04:55.1662581; hello world
2013-Jan-19 23:04:55.1662596; goodby
</pre>
 
=={{header|Erlang}}==
If we consider the usage of history variables, like not losing the old value by mistake or having a way to get an old value, then Erlang can really help. Being single assignment Erlang will not allow you to lose an old value, and it is certain that the previous values are always there. The downside is that you must handle this manually.
 
{{out}}
<pre>
1> V1 = "123".
"123"
2> V1 = V1 ++ "qwe".
** exception error: no match of right hand side value "123qwe"
3> V2 = V1 ++ "qwe".
"123qwe"
4> V3 = V2 ++ "ASD".
"123qweASD"
5> V1.
"123"
6> V2.
"123qwe"
7> V3.
"123qweASD"
</pre>
 
Anonymous user