Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET := Operator

What does the following mean?

Class.Function(variable := 1 + 1)

What is this operator called, and what does it do?

like image 549
Kevin Avatar asked Oct 15 '08 14:10

Kevin


People also ask

What is the difference between the and := operator?

= operator assigns a value either as a part of the SET statement or as a part of the SET clause in an UPDATE statement, in any other case = operator is interpreted as a comparison operator. On the other hand, := operator assigns a value and it is never interpreted as a comparison operator.

What are the Visual Basic operators?

Visual Basic provides the following types of operators: Arithmetic Operators perform familiar calculations on numeric values, including shifting their bit patterns. Comparison Operators compare two expressions and return a Boolean value representing the result of the comparison.

What are the 4 major operators being used in Visual Basic?

Comparison Operators. Logical/Bitwise Operators. Bit Shift Operators. Assignment Operators.


1 Answers

It is used to assign optional variables, without assigning the previous ones.

sub test(optional a as string = "", optional b as string = "")
   msgbox(a & b)
end sub

you can now do

test(b:= "blaat")
'in stead of
test("", "blaat")
like image 158
Ikke Avatar answered Sep 24 '22 19:09

Ikke