📄 vbs416.htm
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>
<HEAD><TITLE>+ Operator</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="PRODUCT" CONTENT="Visual Basic Scripting Edition">
<META NAME="TECHNOLOGY" CONTENT="SCRIPTING">
<META NAME="CATEGORY" CONTENT="Language Reference">
<META NAME="Keywords" CONTENT="adding,plus sign,+ (operator),sum operator,math operators,operators math,addition operator,operator addition,arithmetic operators,operators arithmetic,strings concatenating,symbols concatenation,concatenation operators,operators concatenation,symbols arithmetic operators,operators,operator,strings,symbols"><META NAME="Description" CONTENT="+ Operator"></HEAD>
<BODY BGCOLOR=FFFFFF LINK=#0033CC>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR VALIGN=TOP><TD WIDTH=360>
<FONT SIZE=1 COLOR=#660033>Microsoft® Visual Basic® Scripting Edition</FONT><BR>
<FONT SIZE=5 COLOR=#660033><B>+ Operator</B></FONT>
</TD>
<TD ALIGN=RIGHT>
<FONT SIZE=2> <A HREF="vbstoc.htm">Language Reference</A> <BR>
<A HREF="vbs16.htm">Version 1</A> <P></FONT>
</TD></TR>
</TABLE>
<FONT SIZE=2><P>
<A HREF="vbs417.htm">See Also</A></FONT>
<HR NOSHADE SIZE=1>
<H5>Description</H5>
<BLOCKQUOTE>Used to sum two numbers.</BLOCKQUOTE>
<H5>Syntax</H5>
<BLOCKQUOTE><i>result</i> <b>=</b> <i>expression1 <B>+</B> expression2</i><P>
The <b>+</b> operator syntax has these parts:<P>
<TABLE WIDTH=87% BORDER=1 CELLPADDING=5 CELLSPACING=0>
<TR VALIGN=TOP BGCOLOR="#DDDDDD">
<TD><FONT SIZE=2><b>Part</b></FONT></TD>
<TD><FONT SIZE=2><b>Description</b></FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>result</i></FONT></TD>
<TD><FONT SIZE=2>Any numeric variable.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>expression1</i></FONT></TD>
<TD><FONT SIZE=2>Any <A HREF="vbs0.htm#defExpression">expression</A>.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>expression2</i></FONT></TD>
<TD><FONT SIZE=2>Any expression.</FONT></TD></TR></TABLE>
</BLOCKQUOTE>
<H5>Remarks</H5>
<BLOCKQUOTE>Although you can also use the <b>+</b> operator to concatenate two character strings, you should use the <b>&</b> operator for concatenation to eliminate ambiguity and provide self-documenting code.<P>
When you use the <b>+</b> operator, you may not be able to determine whether addition or string concatenation will occur.
<P>
The underlying subtype of the expressions determines the behavior of the <b>+</b> operator in the following way:<P>
<TABLE WIDTH=87% BORDER=1 CELLPADDING=5 CELLSPACING=0>
<TR VALIGN=TOP BGCOLOR="#DDDDDD">
<TD><FONT SIZE=2><b>If </b></FONT></TD>
<TD><FONT SIZE=2><b>Then</b></FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2>Both expressions are numeric</FONT></TD>
<TD><FONT SIZE=2>Add.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2>Both expressions are strings</FONT></TD>
<TD><FONT SIZE=2>Concatenate.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2>One expression is numeric and the other is a string</FONT></TD>
<TD><FONT SIZE=2>Add.</FONT></TD></TR></TABLE>
If one or both expressions are <b>Null</b> expressions, <i>result</i> is <b>Null</b>. If both expressions are <b>Empty</b>, <i>result</i> is an <b>Integer</b> subtype. However, if only one expression is <b>Empty</b>, the other expression is returned unchanged as <i>result</i>.
</BLOCKQUOTE>
<hr noshade size=1>
<p align=center><em><a href="../../common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
</FONT></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -