Assigning String and Integer to Variable

AI Thread Summary
To assign a string combined with an integer to a variable, the user seeks a method to concatenate the fixed string "Sym_" with the integer from another variable, n. The desired output is "Sym_10" when n equals 10. The user notes that the "Print()" command does not directly assign values to variables and questions if it can be utilized for this purpose. A suggestion is made to use "JoinStringsWithSeparator(list,[])" as a workaround, although it is not considered an elegant solution. The discussion highlights the need for a straightforward method to concatenate strings and integers in variable assignments.
arokum
Messages
2
Reaction score
0
Hi everyone,

I'm trying to assign a string in combination with an integer to a variable v. The string-part is fix, the integers comes from another variable n. For Example:

Code:
n:=10;
Print("Sym_",n);

The output of "Print(...);" (that is "Sym_10") should be assigned to another variable. Does anyone know how to do that? There doesn't seem to be a functionality analogue to the "Print()" command when it comes to assigning values to variables. Or can I use "Print()" in some way to solve my problem?

Thanks in advance.

Kind regards,
arokum
 
Physics news on Phys.org
Hello again,

Using "JoinStringsWithSeparator(list,[])" is no nice solution, though it works.

Kind regards,
arokum
 

Similar threads

Replies
3
Views
3K
Replies
5
Views
2K
Replies
3
Views
3K
Replies
2
Views
4K
Replies
6
Views
3K
Replies
4
Views
11K
Replies
3
Views
7K
Back
Top