// The basic closure syntax is:
// { (parameter: Type) -> Type in <statements> }
//
// While closures can be assigned to a variable like in
// the example below, they become much more useful once
// they're passed into a function such as a list's `filter`
// method.
let closure = { (a: Int, b: Int) -> Int in return a * b }
print(closure(3, 6)) // 18
print(closure(10, 2)) // 20
{
print("Hello World")
}
// declare a closure
var greet = {
print("Hello, World!")
}
// call the closure
greet()
{ (parameters) -> return type in
statements
}
//Closure Expression Syntax
//Closure expression syntax has the following general form: