[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An assignment stores a new value into a variable. It's syntax is quite straightforward:
variable = expression |
As a result of the assignment, the expression is evaluated and its value is assigned to variable. If variable did not exist before the assignment, it is created. Otherwise, whatever old value it had before the assignment is forgotten.
It is important to notice that variables do not have permanent types. The type of a variable is the type of whatever value it currently holds. For example:
foo = 1 print $foo => 1 foo = "bar" print $foo => bar foo = ( User-Name = "antonius" NAS-IP-Address = 127.0.0.1 ) print $foo => ( User-Name = "antonius" NAS-IP-Address = 127.0.0.1 ) |
Another important point is that in radtest
, assignment is
not an expression, as it is in many other programming languages. So
C
programmers should resist temptation to use assignments in
expressions. The following is not correct:
x = y = 1 |
Finally, if the variable name coincides with one of radtest
keywords, it must be enclosed in single quotes:
'case' = 1 |