Next | The Identity Function | 8 |
Beginners frequently ask why this didn't work:
print "Next year, I will make $SALARY*1.06 dollars\n";
# I got: Next year, I will make 45000*1.06 dollars
# I wanted: Next year, I will make 47700 dollars
The answer is that expressions are not evaluated inside of strings
Why should they be?
The quote marks specifically mean you don't evaluate
That's the whole point
Next | Copyright © 2001 M. J. Dominus |