More work on the site.

- Tweaked the design a bunch.
- Started filling in core library docs.
- Fixed some other prose.
This commit is contained in:
Bob Nystrom
2014-08-24 09:09:10 -07:00
parent d5f68d70f0
commit 4dcb68d9b9
5 changed files with 342 additions and 21 deletions
+2 -2
View File
@@ -60,7 +60,7 @@ Once you have a function, how do you invoke it? Like everything in Wren, you do
}
}
Functions expose a `call` method that executes the body of the function. Of course, this is dynamically-dispatched like other methods, so you can define your own "function-like" classes and pass them to methods that expect real functions.
Functions expose a `call` method that executes the body of the function. This method is dynamically-dispatched like any other, so you can define your own "function-like" classes and pass them to methods that expect "real" functions.
:::dart
class FakeFn {
@@ -73,7 +73,7 @@ Functions expose a `call` method that executes the body of the function. Of cour
## Function parameters
Of course, functions aren't very useful if you can't pass values to them. The functions that we've seen so far take no parameters. To change that, you can provide a parameter list surrounded by `|` immediately after the opening brace of the body, like so:
Of course, functions aren't very useful if you can't pass values to them. The functions that we've seen so far take no arguments. To change that, you can provide a parameter list surrounded by `|` immediately after the opening brace of the body, like so:
:::dart
blondie.callMe {|first, last|