Learn how to add comments to your code to make it easier to understand, organize code for display and navigation in the jump bar, and use markup syntax to format comment text.
- [Instructor] Swift promotes writing expressive code…that reads well and is easy to understand.…A well-written method, for example,…should read like a sentence.…Add fresh vegetables to wok returns a meal.…Still, adding comments to your code…can go a long way towards helping your fellow programmers…understand how to work with the code you've written…such as to provide details about parameters…for a method or example use cases,…and I'll be honest, I've lost count of how many times…I've looked back on old code that I've written…and wondered, what was I thinking?…The syntax to write a single-line comment…is to write two forward slashes…followed by your comment text.…
Single-line comments also support using landmarks…which will be displayed in the jump bar,…and that runs along the top of the source editor,…and is currently displaying the playground file name.…Because the jump bar does not display landmarks…in the main playground file,…I'll show them in a separate source file…that I've added to the playground sources folder,…
Learn how to write code, understand Swift's key concepts and best practices, and strengthen your programming problem-solving skills. Instructor Scott Gardner teaches the fundamentals, so you'll be prepared to develop applications for iOS, macOS, and other platforms. Completing this course will enable you to not only write first-class code, but to think like a Swift developer.
- Creating playgrounds
- Defining variables and constants
- Working with characters and strings
- Working with collections and groups
- Using operators and defining custom operators
- Controlling program flow
- Defining functions and closures
- Working with classes, structures, and enumerations
- Adopting protocols
Skill Level Beginner
1. Get Started
2. Variables and Constants
3. Characters and Strings
4. Collections and Tuples
6. Control Flow
- 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.