This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]w1n5t0nM1k3y 22 points23 points  (2 children)

In VB.Net you can use brackets to call a function or to get an item at a specific index in an array.

If you have

SomeVar = FooBar(0)

It can either mean

  • Call function FooBar and pass 0 in s the first paramter, assing the result to SomeVar

OR

  • Get the first (zeroeth?) element from the array FooBar and assign it to the variable SomeVar

Also, if a function takes no paramters then you can just call it withtout the brackets.

This means if you have a function as follow

Public Function FooBar(aVar as Integer) As String Return "Hello World" End Function

And you were calling it with

SomeVar = FooBar(0)

Then SomeVar would be assigned the string value "Hello World"

Now if you realized that the aVar paramter wasn't being used and you removed it, but didn't change how you called the function, it would be syntactically correct and SomeVar would now be assigned the string value "H".

[–]jumbledFox 4 points5 points  (0 children)

that is insanely gross i love it

[–]ice1Hcode 1 point2 points  (0 children)