Home > Software engineering >  Connection of variables
Connection of variables

Time:10-23

Ask A question, two string variables A, B, is it can be used, please A=A & amp; B?

CodePudding user response:

Of course you can.
Can also be A=A + B (premise is string type)

CodePudding user response:

I cycle to run A few times, however, the result variable or equal to B, don't understand very much

CodePudding user response:

Such as, for example, two string variables A, B, B='DOG', cycle twice A=A & amp; A=B, then, should 'DOGDOG', but the result is actually A='DOG', where is the problem, ask tall person to give directions

CodePudding user response:

Can, if A, B is not value, can also be A=A + B,

CodePudding user response:

refer to the second floor damonking response:
but I cycle run several times, the result variable or equal to B, don't understand very much


Aren't you A assignment?

CodePudding user response:

Doubt the building may be dimmed eyesight

CodePudding user response:

You don't cycle, write directly

As the String Dim A, B As String

B="Dog"
A=b & amp; B
A=b & amp; B

MsgBox a.

CodePudding user response:

On the building code, how could such a simple string concatenation is haunted,
 Private Sub Command1_Click () 
Dim As A String
Dim As String B
Dim As Long I
B="DOG"
For I=1 To 2
A=b & amp; B
Next
MsgBox A
End Sub

CodePudding user response:

refer to the second floor damonking response:
but I cycle run several times, the result variable or equal to B, don't understand very much

Likely, your program code, there is something wrong with the logic bai,
Like this:
 B=
"DOG"For I=1 to 100
.
.
A=""
.
.
.
.
A=b & amp; B

The end result, of course, A can only be "DOG,"

CodePudding user response:

Dizzy, the last line of the Next had mysteriously disappeared...

CodePudding user response:

The original poster should be that less off yourself, step through see
Digital & amp; String sometimes is equal to the number

But the string & amp; The string must be a string
  • Related