Functions

A method/function is a way to perform some task. Similarly, in programming like Java, a function method is a block of code written to perform a specific task repeatedly. It provides reusability of code. We write the function once and use it many times. It works on the ‘DRY’ principle i.e., “Do not repeat yourself”.

Steps -

  1. Define function - datatype function_name(parameters){body}
  2. Call function - function_name(values)

Visit the following resources to learn more: