Skip to content

Operators

Sergey Makeev edited this page Aug 29, 2019 · 11 revisions

Operators: SwiftWhen provides several operators.

var nonOptionalResult = 3
nonOptionalResult =? state == .finished => { 0 } =>? {
	state == .working || state == .pausing => { 1 } =>? {
		state == .idle || state == .preparing || state == .ready => { 2 }
	}
}
true => true => true == true
let result = left =>? { middle } =>? { right } =>! { default }
let result = leftCondition == true => { ifBranch } =>? { middleCondition => { elseIfBranch}  =>! { default }}

Clone this wiki locally