Tutorial by Examples

' Sometimes we don't need to evaluate all the conditions in an if statement's boolean check. ' Let's suppose we have a list of strings: Dim MyCollection as List(Of String) = New List(of String)() ' We want to evaluate the first value inside our list: If MyCollection.Count > 0 And MyCo...
' The OrElse operator is the homologous of AndAlso. It lets us perform a boolean ' comparison evaluating the second condition only if the first one is False If testFunction(5) = True OrElse otherFunction(4) = True Then ' If testFunction(5) is True, otherFunction(4) is not called. ' In...
7.0 OrElse Sub Main() Dim elements As List(Of Integer) = Nothing Dim average As Double = AverageElementsOrElse(elements) Console.WriteLine(average) ' Writes 0 to Console Try 'Throws ArgumentNullException average = AverageElementsOr(elements) Catch ex ...

Page 1 of 1