
Using the term "method" instead of "function"
You are going to see the words "function" and "method" used everywhere as you learn how to code.
The words "function" and "method" truly mean the same thing in Unity. They also do the same thing.
Since you are studying C#, and C# is an Object–Oriented Programming (OOP) language, I will use the word method throughout this book, just to be consistent with C# guidelines. It makes sense to learn the correct terminology for C#. The authors of Scripting Reference probably should have used the word "method" instead of "function" in all of their documentation. Anyway! Whenever you hear either of these words, remember that they both mean the same thing.
From now on, I'm going to use the word method or methods in this book. When I refer to the functions shown in Scripting Reference, I'm going to use the word "method" instead, just to be consistent.
We're going to edit the variableScript again. In the following screenshot, there are a few lines of code that look strange. We are not going to get into the details of what they mean in this chapter. We will discuss that in Chapter 4, Getting into the Details
of Methods. Right now, I am just showing you a method's basic structure and how it works:
- In MonoDevelop, select variableScript for editing
- Edit the file so that it looks exactly like what is shown in the following screenshot:

- Save the file
In the previous screenshot, lines 6 and 7 will look familiar to you. They are variables, just as you learned in the previous section. There are two of them this time. These variables store the numbers that are going to be added.
Line 16 may look very strange to you. Don't concern yourself right now with how it works. Just know that it's a line of code that lets the script know when the Enter key is pressed. On the keyboard method, AddTwoNumbers will be called into action.
The simplest way to call a function in your code is by using its name followed by brackets and a semicolon, for example, AddTwoNumbers();.