name = value
Create a new scalar variable and assign it an initial value.
name
value
String s = "This is a test string.\n" print $s
text
variable is declared both outside the while()
loop and within it. This results
in two variables, one that is only visible to statements within
the body of the while()
loop, and another that is
potentially visible in both places but becomes hidden by the
nested declaration until the the loop completes. Note that
statements in the while loop that precede the nested declaration
see the outer declaration.
String text = "Outer.\n" print "A ", $text while($iteration < 1) { print "B ", $text String text = "Nested.\n" print "C ", $text } print "D ", $textThis produces the following output:
A Outer B Outer C Nested D Outer
if
statements, and the bodies of
user-defined commands.