Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
After the name of the function, we need opening and closing parentheses. These say whether this function expects to have data passed into it which we'll get to later. In this case, empty parentheses means no, it doesn't. Now that we've created this function, we can call it. So somewhere else a little bit later in the program, I can use the name of the function followed by the empty parentheses and a semicolon.
So whether they use the term functions, modules, subroutines, methods, this idea of treating a block of code as a callable unit inside a larger program is a core feature of all programming languages. It makes your programs easier to write and easier to understand. You can split work among different programmers by giving them different parts to write. Now functions can of course get more complex than basic ones shown here. They might not just perform an operation, but they might return values or they might accept data, and we'll see how to do that next.
Find answers to the most frequently asked questions about Foundations of Programming: Fundamentals.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.