|
-
March 19th, 2005, 11:52 PM
#1
Declaring a method...
Stupid question (can't find the answer in the book .) When strict is on, what do you put at the end of a method declaration in order to make it compile when you don't want to return anything (in C/C++ you have void)?
Code:
Option Strict On
Option Explicit On
Module Module1
Sub Main()
End Sub
Function Addition(ByVal n As Integer, ByRef result As Integer) As Nothing
End Function
End Module
-
March 20th, 2005, 01:41 AM
#2
Re: Declaring a method...
Instead of function you use Sub:
Public Sub YourSub(param1 as Type1, param2 as Type2)
End Sub
You can see that Sub do not return any type.
-
March 20th, 2005, 02:27 AM
#3
Re: Declaring a method...
So I take it that what I wanted to do initially (given that Strict is on) with a Function is impossible? Just curious...
-
March 21st, 2005, 09:08 AM
#4
Re: Declaring a method...
Yes. A function returns a value, a Sub does not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|