Topic was automatically imported from the old Question2Answer platform.
Asked By
Saphereye
In python you can do print("Hello", end = '') print("World")
to produce "Hello World" as a string,
Is there a similar functionality for print in GDScript?
If it helps : i am trying to print out a list in a form of table
Edit : I FOUND A WAY, kind of, i used a string to record each iteration and printed it in the end of loop, eg:
if i have numList = [1,2,3,1,2,3,1,2,3]
then outputString= '' for x in 3: ....for y in 3: ........outputString += numList[x + 3 * y] ....print(outputString) ....outputString = ''
I’m not sure where (or why) you’re trying to use the print function, but… There’s a similar printraw('string') function that does not automatically add newline, but it only outputs to the terminal window, not to in-editor console.
var one_var : int = 100
print("You have ", str(one_var), " dollars")
It print "You have 100 dollars.
By default, print() try to convert variable as string. So many built-in type don’t need str() like Vector, Dictionnary, Array…
You can use ’ instead " for raw like :
print("Hello", '\n', "World")
It print :
Hello
World
But, i don(t think we can loop on array (for example) inside print function.