Changes between Version 2 and Version 3 of ControlSystems/SoftwareTeam/Training/GettingStarted/Methods


Ignore:
Timestamp:
Nov 4, 2019, 3:55:26 PM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/Training/GettingStarted/Methods

    v2 v3  
    1919   }
    2020}}}
    21 The function's name is 'square' and it takes an input parameter that is an integer and is referred to within the function as a. The function returns an integer that it computes by multiplying a by itself.
     21
     22* The function's name is 'square' (notice that function names are typically verbs because they ''do'' something). 
     23* It takes an input parameter that is an integer and is referred to within the function as a.
     24* The function returns an integer that it computes by multiplying a by itself.
     25
     26You could use the square function as follows:
     27{{{
     28   int a = 9;
     29   int b = square(a);
     30}}}
    2231
    2332Functions can take more than one parameter, but they can only return 1 value (or no values).  Consider this function that takes two input parameters and returns no value: