Join Harrison Ferrone for an in-depth discussion in this video Work with numbers, part of Learning Swift 3 for Developers.
- [Instructor] Let's make some room at the bottom…of our file and add a new comment.…Backslash star, working with numbers.…Star, backslash.…Now, let's declare a few variables to help us illustrate…how Swift works with numbers.…Let's start with an integer, called anInteger.…Type Int.…We're just going to set it to one.…We're also going to have a variable called aDouble…with a type Double and an initial value of 2.0.…
Going into the storage capacity and limitations…of these variables types is outside our course scope,…but I encourage you to take a look at Apple's documentation…on numeric variable types and their underlying complexities.…For now, let's focus on what we need to know…in order to say converge,…or perform operations with numbers.…Let's convert our integer variable into a double,…and our double into a float.…Let's declare another variable called doubleFromInt…of type Double.…
And we're going to try and set this to anInteger.…We're going to get an error, because anInteger is an int,…and double from int is aDouble.…
- Starting a new playground
- Printing to the console
- Declaring variables
- Working with numbers
- Using strings
- Breaking down optionals
- Understanding closures
- Classes vs. structs
- Extensions and protocols
Skill Level Beginner
1. Hello Swift
2. Back to Basics: Variables and Operators
3. Collections, Tuples, and Enumerations
4. Working with Logic Flows
5. Only in Swift: Optionals
6. Functions, Closures, and Associated Types
7. Classes vs. Structs
8. Advanced Topics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.