Replies: 3 comments 2 replies
-
Are you sure you mean ALL Strings? Your proposal would, somewhat undesirably, do this, too: var a = "World"
print("Hello ", a , "!") # outputs "Hello ""World""!" |
Beta Was this translation helpful? Give feedback.
-
That's very good point. I checked how printing works in Javascript and the same system might be good also in GDScript. Plain strings are printed without quotation marks, but when string is part of some structure, e.g. array or dict, quotation marks are printed. For example (Javascript code): console.log('hello')
console.log([1, 2, 3])
console.log(['1', '2', '3'])
console.log({ foo: 1, bar: 'abc' })
console.log('hello', 'world', { foo: 1, bar: 'abc' }) Output:
|
Beta Was this translation helpful? Give feedback.
-
This is already being tracked in #2623. |
Beta Was this translation helpful? Give feedback.
-
Currently
print()
prints strings without quotation marks. Because of that it can be impossible to see whether some value is a string or a number. For example these three different dicts are printed exactly the same:Output:
(The keys may be in different order depending on the Godot version, the example output is from v4.0.alpha6.)
I suggest that quotation marks are printed around strings so that the output would be:
Beta Was this translation helpful? Give feedback.
All reactions