Swift Tutorial: if/else/else if and ternary operator

Опубликовано: 30 Апрель 2026
на канале: Swift Goose
792
34

In this Swift tutorial video we'll look at control flow using if, else, else if, and the ternary operator. We'll see how to direct the flow of your Mac program in an example containing Bitcoin and CheeseCoin prices.

We look at if statements with function calls in the statement, && (and) and || (or) operators, nested if statements, else if statements, one-line if statements, and the ternary operator.

00:00 Intro
00:12 Setting variables
00:56 First if statement
01:56 If with function call
03:30 && (and) operator
04:33 || (or) operator
05:57 Nested if statements
07:35 Else if statements
09:25 One-line if statements
10:30 Ternary operator
12:05 End

Subscribe for more content, as I will be creating more tutorial and how-to videos for coding in Swift, as well as longer tutorials on building macOS apps.

If you'd like to support my work to help me improve video quality and bring more content, please consider donating to my PayPal:
https://www.paypal.com/paypalme/Swift...

Thank you for watching!

Huge thank you to the channels below for helping me get started!
Uncreated Light Press
   / @uncreatedlightpress  
and

Mr. Macintosh
   / @mr.macintosh  
and

The Apple Ninja
   / jessetheappleninja