2015-06-18 67 views
1

我刚刚开始了一个关于VBScript的视频,在几个教程后,我决定创建一个USD到EUR的转换器。这里的代码:货币转换功能不起作用

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 

有人可以告诉我我要去哪里错了吗?

+0

的可能重复的[VBScript的:从函数返回值](http://stackoverflow.com/questions/15667421/vbscript-return-从功能价值) – Helen

回答

3

在VBScript,函数的值分配给它返回到本身

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

谢谢,我想我完全忘了那个... – lupo19

+0

@ lupo19,好吧,不完全:你用它在最后一个函数。阅读我们自己的代码时,我们都有时会失明。 –