Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a Sub and returning a value

This might seem like an insanely easy question, but I can't seem to find an answer anywhere to it. I'd like to think that I am decent at VB but while I was learning javascript the other day I found something that seemed awesome and now I can't figure out how to do it in VB.

In javascript it looks like this:

var someValue = getThatValue()

It's both calling and setting the value from the getThatValue() sub. what is the VB equivalent?


Edit

I've tried doing this:

   private sub main()        dim value = getValue()        'do something with value    end sub     private sub getValue()        return 3    end sub 

That doesn't seem to work, how can I get that to work?

like image 730
Nefariis Avatar asked Mar 15 '12 18:03

Nefariis


1 Answers

Private Sub Main()     Dim value = getValue()     'do something with value End Sub  Private Function getValue() As Integer     Return 3 End Function 
like image 177
Kevin Avatar answered Oct 08 '22 22:10

Kevin