Functions and subroutines (subs) are very similar; both enable you to create a reusable block of code that you can call from other locations in your application. The difference between a function and a subroutine is that a function can return data whereas a sub doesn’t. Together, functions and subroutines are referred to as methods. You can also check here what is log4net?
They can be parameterized. That is, you can pass in additional information that can be used inside the function or subs.
‘ Define a function
Public Function FunctionName ([parameterList]) As DataType
‘ Define a subroutine
Public Sub SubName ([parameterList])
// Define a function
public datatype FunctionName([parameterList])
// Define a subroutine
public void SubName([parameterList])
The complete first line, starting with Public, is referred to as the method signature because it defines the look of the function, including its name and its parameters. The Public keyword (public in C#) is called an access modifier and defines to what extent other web pages or code files can see this method.
The name of the function is followed by parentheses, which in turn can contain an optional parameter list. Both the function and subroutine have a parameter list that enables you to define the name and data type of variables that are passed to the method. Inside the method, you can access these variables as you would normal variables.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: