@@ -908,7 +908,7 @@ of the parameter is the ``set-name``, if provided, or ``value`` otherwise.
908
908
var vec = BitVector64()
909
909
vec[2] = true
910
910
if vec[3] {
911
- println ("third bit is set")
911
+ print ("third bit is set")
912
912
}
913
913
914
914
.. _langref.decl.attribute_list :
@@ -977,21 +977,21 @@ of :ref:`switch statements <langref.stmt.switch>`. Some examples::
977
977
// Extract the elements of the "point" tuple and bind them to
978
978
// variables x, y, and z.
979
979
var (x, y, z) = point
980
- println ("x=\(x) y=\(y) z=\(z)")
980
+ print ("x=\(x) y=\(y) z=\(z)")
981
981
982
982
// Dispatch on the elements of a tuple in a "switch" statement.
983
983
switch point {
984
984
case (0, 0, 0):
985
- println ("origin")
985
+ print ("origin")
986
986
// The pattern "_" matches any value.
987
987
case (_, 0, 0):
988
- println ("on the x axis")
988
+ print ("on the x axis")
989
989
case (0, _, 0):
990
- println ("on the y axis")
990
+ print ("on the y axis")
991
991
case (0, 0, _):
992
- println ("on the z axis")
992
+ print ("on the z axis")
993
993
case (var x, var y, var z):
994
- println ("x=\(x) y=\(y) z=\(z)")
994
+ print ("x=\(x) y=\(y) z=\(z)")
995
995
}
996
996
997
997
@@ -1061,13 +1061,13 @@ bindings are immutable.
1061
1061
switch point {
1062
1062
// Bind x, y, z to the elements of point.
1063
1063
case (var x, var y, var z):
1064
- println ("x=\(x) y=\(y) z=\(z)")
1064
+ print ("x=\(x) y=\(y) z=\(z)")
1065
1065
}
1066
1066
1067
1067
switch point {
1068
1068
// Same. 'var' distributes to the identifiers in its subpattern.
1069
1069
case var (x, y, z):
1070
- println ("x=\(x) y=\(y) z=\(z)")
1070
+ print ("x=\(x) y=\(y) z=\(z)")
1071
1071
}
1072
1072
1073
1073
Outside of a <tt>var</tt> pattern, an identifier behaves as an :ref: `expression
@@ -1080,9 +1080,9 @@ pattern <langref.pattern.expr>` referencing an existing definition.
1080
1080
// x and z are bound as new variables.
1081
1081
// zero is a reference to the existing 'zero' variable.
1082
1082
case (var x, zero, var z):
1083
- println ("point off the y axis: x=\(x) z=\(z)")
1083
+ print ("point off the y axis: x=\(x) z=\(z)")
1084
1084
default:
1085
- println ("on the y axis")
1085
+ print ("on the y axis")
1086
1086
}
1087
1087
1088
1088
The left-hand pattern of a :ref: `var declaration <langref.decl.var >` and the
@@ -1151,11 +1151,11 @@ appear in declarations.
1151
1151
for b in bs {
1152
1152
switch b {
1153
1153
case is B:
1154
- println ("B")
1154
+ print ("B")
1155
1155
case is D1:
1156
- println ("D1")
1156
+ print ("D1")
1157
1157
case is D2:
1158
- println ("D2")
1158
+ print ("D2")
1159
1159
}
1160
1160
}
1161
1161
@@ -1183,11 +1183,11 @@ type, the value of that type can be matched against an optional subpattern.
1183
1183
1184
1184
switch tag {
1185
1185
case .BR:
1186
- println ("<br>")
1186
+ print ("<br>")
1187
1187
case .IMG(var src, var alt):
1188
- println ("<img src=\"\(escape(src))\" alt=\"\(escape(alt))\">")
1188
+ print ("<img src=\"\(escape(src))\" alt=\"\(escape(alt))\">")
1189
1189
case .A(var href):
1190
- println ("<a href=\"\(escape(href))\">")
1190
+ print ("<a href=\"\(escape(href))\">")
1191
1191
}
1192
1192
1193
1193
Enum element patterns are refutable and thus cannot appear in declarations.
@@ -1213,12 +1213,12 @@ operator may be overloaded like any function.
1213
1213
switch point {
1214
1214
// Equality comparison.
1215
1215
case (0, 0, 0):
1216
- println ("origin")
1216
+ print ("origin")
1217
1217
// Range comparison.
1218
1218
case (-10...10, -10...10, -10...10):
1219
- println ("close to the origin")
1219
+ print ("close to the origin")
1220
1220
default:
1221
- println ("too far away")
1221
+ print ("too far away")
1222
1222
}
1223
1223
1224
1224
// Define pattern matching of an integer value to a string expression.
@@ -1229,9 +1229,9 @@ operator may be overloaded like any function.
1229
1229
// Now we can pattern-match strings to integers:
1230
1230
switch point {
1231
1231
case ("0", "0", "0"):
1232
- println ("origin")
1232
+ print ("origin")
1233
1233
default:
1234
- println ("not the origin")
1234
+ print ("not the origin")
1235
1235
}
1236
1236
1237
1237
The order of evaluation of expressions in patterns, including whether an
@@ -1347,22 +1347,22 @@ otherwise empty cases in switch statements.
1347
1347
func classifyPoint(point: (Int, Int)) {
1348
1348
switch point {
1349
1349
case (0, 0):
1350
- println ("origin")
1350
+ print ("origin")
1351
1351
1352
1352
case (_, 0):
1353
- println ("on the x axis")
1353
+ print ("on the x axis")
1354
1354
1355
1355
case (0, _):
1356
- println ("on the y axis")
1356
+ print ("on the y axis")
1357
1357
1358
1358
case (var x, var y) where x == y:
1359
- println ("on the y = x diagonal")
1359
+ print ("on the y = x diagonal")
1360
1360
1361
1361
case (var x, var y) where -x == y:
1362
- println ("on the y = -x diagonal")
1362
+ print ("on the y = -x diagonal")
1363
1363
1364
1364
case (var x, var y):
1365
- println ("length \(sqrt(x*x + y*y))")
1365
+ print ("length \(sqrt(x*x + y*y))")
1366
1366
}
1367
1367
}
1368
1368
0 commit comments