mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-29 17:40:42 +02:00
Update Swift pre-decrement syntax to match v3.0 (#2395)
This commit is contained in:
@@ -94,7 +94,7 @@ var unwrappedString: String! = "Value is expected."
|
||||
// same as above, but ! is a postfix operator (more syntax candy)
|
||||
var unwrappedString2: ImplicitlyUnwrappedOptional<String> = "Value is expected."
|
||||
|
||||
// If let structure -
|
||||
// If let structure -
|
||||
// If let is a special structure in Swift that allows you to check if an Optional rhs holds a value, and in case it does - unwraps and assigns it to the lhs.
|
||||
if let someOptionalStringConstant = someOptionalString {
|
||||
// has `Some` value, non-nil
|
||||
@@ -443,7 +443,7 @@ internal class Rect: Shape {
|
||||
|
||||
func shrink() {
|
||||
if sideLength > 0 {
|
||||
--sideLength
|
||||
sideLength -= 1
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user