Skip to content

Latest commit

 

History

History
19 lines (10 loc) · 1.17 KB

read07notes.md

File metadata and controls

19 lines (10 loc) · 1.17 KB

An expression evaluates into (results in) a single value. Broadly speaking there are two types of expressions. Expressions rely on things called operators; they allow programmers to create a single value from one or more values.

Functions let you group a series of statements together to perform a specific task. If different parts of a script repeat the same task, you can reuse the function (rather than repeating the same set of statements).

To create a function, you give it a name and then write the statements needed to achieve its task inside the curly braces. This is known as function declaration.

Having declared the function, you can then execute all of the statements between its curly braces with just one line of code. This is known as calling the function.

Sometimes a function needs specific information to perform its task, in such cases, when you declare the function you give it parameters. Inside the function, the parameters act like variables.

When you call a function that has parameters. you specify the values it should use in the parentheses that follow its name. The values are called arguments, and they can be provided as values or as variables.