 
 /*:
  > Look at the Debug console to see what's printed.
+ 
+ But it's even more Swifty to use the return-and-throw pattern to create Results and read their values and errors.
+ You can use a special initializer to create a Result with a returning-or-throwing function. Then you can call `value`, which returns the value or throws the error.
 
- But it's even more Swifty to use the `value` function to determine the case.
- `value` returns the value for `.Success` or throws the error for `.Failure`.
+ Here we create two Results and then print their values, without ever writing enum cases or switch statements.
+ */
+
+let successfulIntArray = Result { [1, 2, 3, 4] }
+let failedIntArray = Result<[Int]> { throw someError }
+
+do {
+    print(try successfulIntArray.value())
+} catch {
+    print(error)
+}
+
+do {
+    print(try failedIntArray.value())
+} catch {
+    print(error)
+}
+
+print()
+
+/*:
+ With this initializer and the `value` function, our code is simple and compact. Creating a Result encodes a returned value or thrown error, and then `value` can return or throw in a new context.
+ 
+ > `init(create:)` and `value` are like other frameworks' `materialize` and `dematerialize`.
  */
 
 func printResult<T>(result: Result<T>) {

    XCPlaygroundPage.currentPage.finishExecution()
}

//: > Even though the asynchronous operation can't `throw` an error into the completion block, it can `throw` to construct a failing Result. We can also `catch` to handle that same failure. By precisely describing what it means to throw an error, `Result<T>` lets us work cleanly across asynchronous boundaries.

//: [Index](Index) • [Promise >>](@next)

func getJSONAndParseValueWithCompletion(completion: ((Result<Int>) -> Void)?) {
    delay(3.0) {
        // Suppose we did a network request to get this response body from an API.
        let jsonStringResult = Result { "{ \"key\": 101 }" }

        let parsedValueResult: Result<Int> = jsonStringResult.tryMap { jsonString in
            // Interpret the response body as JSON.
