ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Using Parentheses

Using Parentheses

原创 Linux操作系统 作者:ipqiaojj 时间:2009-03-14 09:29:43 0 删除 编辑

When programming in VBScript, it is important that you follow the rules for using or not using parentheses () in your statements.

You must use parentheses around method arguments if you are calling a method that returns a value and you are using the return value.

For example, use parentheses around method arguments if you are returning a value to a variable, if you are using the method in an If statement, or if you are using the Call keyword to call a function.

Tip: If you receive an Expected end of statement error message when running a step in your function library, it may indicate that you need to add parentheses around the arguments of the step's method.

Following are several examples showing when to use or not use parentheses.

The following example requires parentheses around the method arguments for the ChildItem method because it returns a value to a variable.

Set WebEditObj = Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").ChildItem (8, 2, "WebEdit", 0)

WebEditObj.Set "Example"

The following example requires parentheses around the method arguments because Call is being used.

Call MyFunction("Hello World")

...

...

The following example requires parentheses around the WaitProperty method arguments because the method is used in an If statement.

If Browser("index").Page("index").Link("All kind of").WaitProperty("attribute/readyState", "complete", 4) Then Browser("index").Page("index").Link("All kind of").Click

End If

The following example does not require parentheses around the Click method arguments because it does not return a value.

Browser("Mercury Tours").Page("Method of Payment").WebTable("FirstName").Click 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16792402/viewspace-567238/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Using Variables
下一篇: 换行连接符号
请登录后发表评论 登录
全部评论

注册时间:2009-02-22

  • 博文量
    140
  • 访问量
    73289