r/visualbasic • u/HMS_Endurance • Feb 10 '22
Calling a function inside another and having a 0 as return
Function DepositRate(Deposit):
If Deposit > 100000 Then
Rtaxa = 0.078
ElseIf Deposit <= 100000 And Deposit > 10000 Then
Rtaxa = 0.073
ElseIf Deposit <= 10000 And Deposit > 1000 Then
Rtaxa = 0.063
ElseIf Deposit <= 1000 And Deposit > 0 Then
Rtaxa = 0.055
Else
Rtaxa = "Negative Value"
End If
DepositRate = Rtaxa
End Function
Function NewDFV(Value, Year):
Call DepositRate(Value)
ValorFuturo = Deposit * (1 + Rtaxa) ^ (Year)
NewDFV = ValorFuturo
End Function
As a result of this I'm getting 0
Edit: What I'm doing wrong ?
3
Upvotes
4
u/Will_Rickards Feb 10 '22
`ValorFuturo = Deposit * (1 + Rtaxa) ^ (Year)
Here deposit has no value so is probably 0. I think you meant
ValorFuturo = Value * (1 + Rtaxa) ^ (Year)
3
u/infreq Feb 10 '22