A function allows you to
encapsulate a piece of code and call it from other parts of your code. You may
very soon run into a situation where you need to repeat a piece of code, from
multiple places, and this is where functions come in. In C#, they are basically
declared like this:
<visibility> <return type> <name>(<parameters>)
{
<function code>
}
To call a function:
PrintFooToScreen();
Example
Output
No comments:
Post a Comment