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.
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.
- Writing source code
- Understanding compiled and interpreted languages
- Requesting input
- Working with numbers, characters, strings, and operators
- Writing conditional code
- Making the code modular
- Writing loops
- Finding patterns in strings
- Working with arrays and collections
- Adopting a programming style
- Reading and writing to various locations
- Managing memory usage
- Learning about other languages