VB.Net Tutorial/Operator/Operator Precedence

Материал из VB Эксперт
Перейти к: навигация, поиск

Operator Precedence

Module Module1
    Sub Main()
        Dim Expression1 As Double
        Dim Expression2 As Double
        Dim Expression3 As Double
        Dim Expression4 As Double

        Expression1 = 5 ^ 2 + 1 * 3 - 4
        Expression2 = 5 ^ (2 + 1) * 3 - 4
        Expression3 = 5 ^ (2 + 1) * (3 - 4)
        Expression4 = 5 ^ ((2 + 1) * (3 - 4))
        Console.WriteLine(Expression1)
        Console.WriteLine(Expression2)
        Console.WriteLine(Expression3)
        Console.WriteLine(Expression4)
    End Sub
End Module
24
371
-125
0.008