1

I just began a video on VBScript, and after a few tutorials, I decided to create a USD to EUR converter. Here's the code:

Option Explicit

Dim inputMoney
inputMoney = CDbl(InputBox("Enter in the number of USD:"))
MsgBox "The amount of " & inputMoney & " USD in EUR is" & convert_to_eur(inputMoney)
MsgBox exit_mssg()

Function convert_to_eur(amount)
    amount = amount * 0.88
End Function

Function exit_mssg()
    exit_mssg = "Thank you"
End Function

Can someone please tell me where I'm going wrong?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
lupo19
  • 11
  • 2
  • possible duplicate of [VBScript: Return value from a function](http://stackoverflow.com/questions/15667421/vbscript-return-value-from-a-function) – Helen Jun 19 '15 at 11:03

1 Answers1

3

In vbscript, functions return a value assigning it to itself

Function convert_to_eur(amount)
    convert_to_eur = amount * 0.88
End Function
MC ND
  • 69,615
  • 8
  • 84
  • 126
  • @lupo19, well, not completely: you used it in the last function. We all are sometimes blind when reading our own code. – MC ND Jun 18 '15 at 18:58