Expression clarification

Hello All,

Could anyone please explain or clarify for me? How the expressions below are derived and used. I mean need to know why we are using in the below image “new” to declare another string array.

And, why we are using string. Join (" ", AX) to display in output panel not as AX only.

@NayabImran

That is to initialize string array with no values.

and in logs you can use ax as well but display will be different…to have display with space separation it is used as above

cheers

1 Like

HI @NayabImran

We are using the New String() {} to initialize the string of array variable that is like telling and confirming the variable will be string of array

And String of Array will not print all of its data in a single line if we use only AX in the log message

SO we needed the expression
String.Join(“Seperator as string”,ArrayOdString)

What it will do is it will combine all the array values into single string with the separator you given

in this your array will be separated with space like

A B C D

Regards
Sudharsan

1 Like

we use the string.Join statement to flatten down the string array to a string. Otherwise we would not see the content fro array when using toString()

grafik

we initialize the String Array with the new statement and assign an empty string array for it

1 Like

Hi @NayabImran ,

An addition to all the above posts, We can test and check what happens when we use an Array String variable directly without initialisation and when used with the Initialisation.

Below are two variables used to demonstrate the differences and also the reasons as to why we would have to initialise the arrays :

From the Debugging Panel :
image

You could notice that the variable which is not initialised provides us with null value, which in turn provides us with errors when checked with array methods such as Count, Append, Concat etc.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.