What is the difference between a function and a subroutine?

1 Answers
Answered by suresh

Difference between a Function and a Subroutine in VBScript

What is the difference between a Function and a Subroutine in VBScript?

In VBScript, a Function and a Subroutine serve different purposes and have distinct characteristics:

Function

A Function is used to perform a specific task and return a value to the calling code. It can accept input parameters, process them, and then return a value back to where it was called.

Subroutine

A Subroutine, also known as a Sub, is a block of code that performs a specific task, but it does not return a value to the calling code. It can accept input parameters and process them internally, but it does not have a return value.

Overall, the key difference between a Function and a Subroutine in VBScript is that a Function returns a value to the calling code, while a Subroutine does not.

Answer for Question: What is the difference between a function and a subroutine?