Why does the function getArea return NULL/Nothing
Module Module3
Dim noOfTriangles As Integer = (3 / 2)
Sub main()
Dim l As Single
Dim n As Integer
l = Console.ReadLine()
n = Console.ReadLine()
Console.WriteLine(getArea(l, n))
Console.ReadKey()
End Sub
Function getArea(ByVal l As Single, ByVal n As Integer)
Dim area As Single = 1
If n = 0 Then
Return Nothing
Else
noOfTriangles = noOfTriangles * 2
Return (((3 ^ (1 / 2)) / 4) * (l ^ 2) + (noOfTriangles * getArea((l / 3), (n - 1))))
End If
End Function
End Module
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…