Hi ,

Can someone tell me why I'm getting 45 as my intuition says it should be 55 instead because of nested functionality...

Option Explicit
Dim z As Integer
Sub Question13()
Dim x As Integer, total As Integer
x = 25
z = 10
total = AddTwo1(x) + z
MsgBox "O/P from Main :" & total
'MsgBox "O/P from AddTwo1 call :" & AddTwo1(x)

End Sub

Function AddTwo1(x As Integer) As Integer
Dim z As Integer
AddTwo1 = AddTwo2(x) + z
'MsgBox "O/P from AddTwo2 call :" & AddTwo2(x)
'MsgBox "O/P from AddTwo1 function :" & AddTwo1
End Function



Function AddTwo2(x As Integer) As Integer
AddTwo2 = x + z
' MsgBox "O/P from AddTwo2 function :" & AddTwo2
End Function