Q&A

Q1:What is the difference between a subroutine and a function?
A1: Subroutines and functions both are modularization control structures that can accept zero or more input parameters. However, a function returns a value, whereas a subroutine does not.
Q2:When calling a function, must its return value be assigned to a variable?
A2: Recall that functions always return a value. Typically, the return value of a function is either used in an expression or stored in a variable. However, it is not required that the return value of a function be used at all. Imagine that we had a function called SaveCustomerInformation(name, age), which took as input parameters the name and age of the customer and saved this information in a database. The return value ...

Get SAMS Teach Yourself ASP.NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.