mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Merge remote-tracking branch 'adambard/master'
This commit is contained in:
commit
29555c9b70
@ -1,5 +1,5 @@
|
||||
---
|
||||
language: d
|
||||
language: D
|
||||
filename: learnd-ru.d
|
||||
contributors:
|
||||
- ["Anton Pastukhov", "http://dprogramming.ru/"]
|
||||
|
@ -60,7 +60,7 @@ also sending the message 'true' to the lobby."
|
||||
|
||||
# Sending messages to objects
|
||||
|
||||
Messages can either be unary, binary or keyword. Precedence is in that order. Unlike Smalltalk, the precedence of binary messages must be specified, and all keywords after the first must start with a capital letter. Messages are separeated from their destination by whitespace.
|
||||
Messages can either be unary, binary or keyword. Precedence is in that order. Unlike Smalltalk, the precedence of binary messages must be specified, and all keywords after the first must start with a capital letter. Messages are separated from their destination by whitespace.
|
||||
|
||||
```
|
||||
"unary message, sends 'printLine' to the object '23'
|
||||
|
@ -94,6 +94,8 @@ 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 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
|
||||
if !someOptionalStringConstant.hasPrefix("ok") {
|
||||
|
Loading…
Reference in New Issue
Block a user