Skip to content

The string concatenation with null has an error #579

@md-frank

Description

@md-frank

Please refer to the following code

# The value of the name variable comes from the return value of another function and may be null
# For simplicity in testing, it is fixed to null here
name = null

text = "my name is " + name
# Interpolated strings are the same.
# text = $"my name is {name}"

# Output the text variable, its value is: null
print text

The same code behaves like this in C#:

string name = null
var text = "my name is " + name

# Output the text variable, its value is: my name is 
Console.WriteLine(text)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions