home *** CD-ROM | disk | FTP | other *** search
-
-
- Listing 1:
- Caption: Some example code blocks that do not use parameters.
-
- local myblock := { | | qout(mvar) }, mvar := "testing"
- eval(myblock) // output: "testing"
-
- local myblock := {|| 5000 }
- x := eval(myblock)
- ? x // output: 5000
-
- local myblock := { | | x++ }
- for y := 1 to 100
- eval(myblock) // crashes because X not defined
- next
- ? x
-
- local myblock := { | | x++ }, x := 1 // much nicer thanks
- for y := 1 to 100
- eval(myblock)
- next
- ? x // output: 101
-
- local myblock := { | | BlueFunc() }
- eval(myblock) // calls BlueFunc() which displays a message
- return nil
-
- static function bluefunc
- ? "here we are in a BlueFunc() - will we ever escape?"
- inkey(5)
- return nil
-