[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Get value back from a sub...

Hi

I want to do something in a sub and then it should give back a value

I know that it can be done something like this:

return = copyfile("c:\test.test")
if return = "ok" then
Do something
else
Do something else
end if

Private sub copyfile(file as string)
Do something
        => HOW CAN I HERE GIVE BACK AN ok if I succeeded?
End sub


Thanks

Sven
0
Ruttensoft
Asked:
Ruttensoft
  • 2
  • 2
1 Solution
 
softplusCommented:
FUNCTION is the name of a sub with a return value
i.e.
Private Function DoSomething(whatever as String) as Double
... do something
   Dim ReturnValue as Double
   ReturnValue = 1 +5 * 8 + 1
   Return ReturnValue
End Function

Return -> will pass the value back to the caller. I.e.
if DoSomething("myname") = 42 then ....
0
 
RuttensoftAuthor Commented:
Thanks!
0
 
softplusCommented:
Very welcome :) sometimes the easy things are the hardest to find :)
0
 
RuttensoftAuthor Commented:
Yeah :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now