使用表达式可以计算某些数学式子的值,如下例题说明了表达式的一种应用方法。
例题2: 将如下3个数学表达式改写成符合VB语法规则的VB表达式,并计算出它们的结果,设x=1,y=5,z=9。

Private Sub Form_Click()
Dim x As Integer, y As Integer, z AsInteger
Dim s1 As Single, s2 As Single, s3 AsSingle
x = 1
y = 5
z = 9
s1 = (1 + y / x) / (1 - y / x)
s2 = x ^ 2 + 3 * x * y / (2 - y)
s3 = Sqr(Abs(x* y - z ^ 3))
Print s1, s2, s3
End Sub