Hi,
Could anyone explain me the difference between a function and a module and aan example or way to difference them in VB.NET
Thanks.
Hi,
Could anyone explain me the difference between a function and a module and aan example or way to difference them in VB.NET
Thanks.
MOdules/Functions
Michael Locker MD
value would you expect the Beep method to return
Microsoft.VisualBasic.Constants.BeepValue = 27
Did you know
TWA
(or, a procedure is a function that doesn't return a value
)
Thanks both of you. A function is easy to understand, but what is the purpose of a procedure that doesnt return anything The only way I can make sense of this is
procedure
beep (in pseudo code I mean...)
END
But that would mean that all procedures that dont return anything are very short or simple, as they always do they same thing. So, is there a complex procedure (like calculating interest rates would be of a function). How about print page, is this a good and complex procedure(but it does take input and varies its output, eg different page to print)
THanks!
Mark Austin
A function is an executable routine, which has intputs and returns a value....
It might look like this:
Protected Function Add (byval Val1 as integer, byval val2 as integer) as integer
end Function
This function return the sum of val1 and val 2.
Functions can be included in both classes and modules.
The primary difference between classes and modules is that a class is instantiated and a class can be run with multiple instantiations.
Modules are files labeled modules and modules may contains variables, functions and subroutines just as a class does only a module is not instantiable. That is to say if a module has a variable called A there will only be one copy of A.
If a class has a variable called A there will be as many A's as there are instantiations of that class.
Does this make sense
antonissap
According to the "normal" definition, a function is a procedure that returns a value (or, a procedure is a function that doesn't return a value
)
Procedures can, and often do, take parameters. One example of a procedure that takes parameters is System.Console.Beep(frequency As Integer, duration As Integer). The Beep method (or procedure) also illustrates why you want procedures in the first place - what value would you expect the Beep method to return
Best regards,
Johan Stenberg
GautamSA
Thank you, I know understand i, but I typed the wrong word. I know what a module is but what I dont know is the difference between a procedure and function. Sorry, so a procedure is like a function but with no input or what
A function can be takin interest rate and money Output money interest. So, what would be a practical use of a procedure
Thanks.