- :any
do
evaluate and execute given code
Parameters
do code :string :block :bytecode
Attributes
times | :integer | repeat block execution given number of times |
Returns
Examples
copydo "print 123" ; 123
copydo [ x: 3 print ["x =>" x] ; x => 3 ]
copyprint do "https://raw.githubusercontent.com/arturo-lang/arturo/master/examples/projecteuler/euler1.art" ; 233168
copydo.times: 3 [ print "Hello!" ] ; Hello! ; Hello! ; Hello!
copy; Importing modules ; let's say you have a 'module.art' with this code: ; ; pi: 3.14 ; ; hello: $[name :string] [ ; print ["Hello" name] ;] do relative "module.art" print pi ; 3.14 do [ hello "John Doe" ; Hello John Doe ] ; Note: always use imported functions inside a 'do block ; since they need to be evaluated beforehand. ; On the other hand, simple variables can be used without ; issues, as 'pi in this example