Predefined Functions

A predefined function is commonly used code that has been written by the creator of a coding language.

At National 5, there are three predefined functions you need to know – Length, Round, and Random.

The Code Always Works – As the code has been written by the developers, the code will almost always work as expected.

Key Points

Predefined Functions are commonly used code.

There are three you must know.

  • Length – Gets the length of something
  • Round – Rounds a number to a decimal place
  • Random – Gets a random number between two numbers

National 5 Requirements

You should be able to explain the benefits of using a predefined function.

You should be able to identify each of the predefined functions.

You should be able to implement each of the predefined functions.