Join Todd Perkins for an in-depth discussion in this video Understanding parameter methods, part of Programming for Non-Programmers with iOS 8.
- Parameter methods can allow you to increase…the usability of your code.…Now I want you to picture a method…that is called addFiveToNumber().…It's very simple.…All it does is takes a number,…and whatever number you send to it, it adds five.…Using parameters we can say addFiveToNumber(1),…and then get the result of six.…Then we can use the same method,…but send different information,…for example, five and get the result ten, and so on.…
So with a parameter method, you have a little bit more power…to recycle your code, for example,…a user scoring in a game can send different points,…and it can add to the score based on the number of points…sent in when the method is executed.…So let's look at how we create a parameter method.…Parameters go within parentheses…of the method declaration, and if you have…multiple parameters you can separate them by commas.…
So first we have the received data.…It's kind of like a variable,…but it's officially called a parameter.…We have the name of it, then we have a colon,…and then we have the data type of the parameter.…
If you find you'd like to learn more, see iOS App Development Essential Training, Foundations of Programming: Fundamentals, or any of the other programming courses in our library.
- Installing Xcode
- Creating an Xcode project
- Configuring the iOS Simulator
- Understanding variables
- Connecting visual objects to variables
- Understanding functions, methods, and selectors
- Connecting a button to a method
- Using conditional statements
- Setting up the user interface
- Connecting code elements to build an app
Skill Level Beginner
1. Setting Up Your Coding Environment
Creating an Xcode project3m 38s
2. Programming Building Blocks: Variables
3. Programming Building Blocks: Functions
4. Programming Building Blocks: Conditional Statements
Using conditional statements4m 11s
5. Building Your First Full Application
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.