User Tools

Site Tools


script:walkthrough:basic_expressions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
script:walkthrough:basic_expressions [2019-11-20 07:27]
skyjake [Numbers and strings]
script:walkthrough:basic_expressions [2019-11-20 07:30]
skyjake
Line 121: Line 121:
   [ 1, One, { 1: One } ]   [ 1, One, { 1: One } ]
  
-The ''​eval()''​ function evaluates its argument as a script and returns the return value from it.+The ''​eval()''​ function evaluates its argument as a script and returns the return value from it. The script gets runs in the same namespace where ''​eval()''​ was called.
  
   $ a = eval("""​ '​arg'​ + '​ument'​ """​)   $ a = eval("""​ '​arg'​ + '​ument'​ """​)
Line 128: Line 128:
   argument   argument
   ​   ​
-  $ eval("""​print "​Printed from eval(): ​%s" ​a"""​)+  $ eval("""​print "​Printed from eval():"​a"""​)
   Printed from eval(): argument   Printed from eval(): argument
script/walkthrough/basic_expressions.txt ยท Last modified: 2019-11-20 07:30 by skyjake