Conditional statements are extremely important in programming. This video shows how to write conditional statements and run code if a given statement is true.
- Now let's look at actually using a conditional statement.…So we're going to put my code inside a view did load,…right below that comment.…We'll actually create a few extra lines for this.…So we talked about earlier…that you create an if statement by using the keyword, if.…We type out if, and then you may see…that this is selected here.…If swift if statement, press the return key on that…and actually Xcode will write it out for you.…So we have if, then we have this condition right here.…Remember this part is evaluated as true or false,…and then we have the curly braces…which enclose the code that runs…if the condition is true.…
So with my cursor on the condition here,…I'm going to type some parentheses,…and then I'm going to type a statement that I know is true.…So if one is less than three, then I'll press…the tab key and that's actually…going to take me to this code block right here,…putting my cursor in between the curly braces.…So in here I'm going to write the word print.…Remember that print is used to put a message…
- Installing Xcode
- Creating an Xcode project
- Configuring the iOS Simulator
- Understanding variables
- Connecting visual objects to variables
- Understanding methods
- Connecting a button to a method
- Using conditional statements
- Setting up the user interface (UI)
- Building a complete iOS app
Skill Level Beginner
1. Set Up Your Coding Environment
Create an Xcode project4m 19s
2. Programming Building Blocks: Variables
3. Programming Building Blocks: Methods
4. Programming Building Blocks: Conditional Statements
5. Plan and Prepare the App
6. Build a Full Application
Next steps3m 11s
- 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.