patterns_19:37_06/29/2015

修改了print函数的缩进格式
This commit is contained in:
ray16897188
2015-06-29 19:38:02 +08:00
parent 84a31ca36b
commit 74cff1433f

View File

@ -75,7 +75,7 @@ let point = (3, 2)
switch point { switch point {
// Bind x and y to the elements of point. // Bind x and y to the elements of point.
case let (x, y): case let (x, y):
print("The point is at (\(x), \(y)).") print("The point is at (\(x), \(y)).")
} }
// prints "The point is at (3, 2).” // prints "The point is at (3, 2).”
``` ```
@ -190,11 +190,11 @@ for case let number? in arrayOfOptinalInts {
let point = (1, 2) let point = (1, 2)
switch point { switch point {
case (0, 0): case (0, 0):
print("(0, 0) is at the origin.") print("(0, 0) is at the origin.")
case (-2...2, -2...2): case (-2...2, -2...2):
print("(\(point.0), \(point.1)) is near the origin.") print("(\(point.0), \(point.1)) is near the origin.")
default: default:
print("The point is at (\(point.0), \(point.1)).") print("The point is at (\(point.0), \(point.1)).")
} }
// prints "(1, 2) is near the origin.” // prints "(1, 2) is near the origin.”
``` ```
@ -208,11 +208,11 @@ return pattern == "\(value)"
} }
switch point { switch point {
case ("0", "0"): case ("0", "0"):
print("(0, 0) is at the origin.") print("(0, 0) is at the origin.")
case ("-2...2", "-2...2"): case ("-2...2", "-2...2"):
print("(\(point.0), \(point.1)) is near the origin.") print("(\(point.0), \(point.1)) is near the origin.")
default: default:
print("The point is at (\(point.0), \(point.1)).") print("The point is at (\(point.0), \(point.1)).")
} }
// prints "(1, 2) is near the origin.” // prints "(1, 2) is near the origin.”
``` ```