Introduction to Functions: an overview

When you keep repeating the same lines of code, you can turn them into a function, one reusable block you call by name.

Novice · Java · Updated

By

A function is a block of reusable code.

As you develop software, you will find that you often write the same lines of code or possibly copy and paste a lot of your code. This is an opportunity for you to look for a repeatable pattern, and instead of copying and pasting that pattern repeatedly, you can convert that code into a function.

Cheat sheets