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
script:walkthrough:basic_expressions [2019-11-20 07:30] (current)
skyjake
Line 25: Line 25:
   Hello World   Hello World
   ​   ​
-  $ print """​I can span+  $ print """​I can "span"
   newlines."""​   newlines."""​
-  I can span+  I can "span"
   newlines.   newlines.
  
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.1574227646.txt.gz ยท Last modified: 2019-11-20 07:27 by skyjake