(1) In programming, a function is a block of interrelated instructions which perform a well-defined action or calculation. Typically one cannot see the code inside a function, which is why they are often referred to as black boxes.
E.g. the bit of code which computes the circumference of a circle given its radius would be a function, whereas the code which creates a file on the disc given a path and some contents would be another kind of function.
(2) In Grasshopper, a function is a conversion from input numbers, usually called x, to output numbers, often called y. Functions in Grasshopper are strictly univariate and only operate on numbers. Examples of common functions are sine, absolute, and polynomials, but there are many different kinds available in Grasshopper.
The image below shows a function which is undefined on the interval (2,3], with a vertical asymptote when approaching 3 from the right.