4 ms·
When you have multiline strings, and don't want to start the lines with whitespace, it means you need to break the indentation of your code, which can look quit
by Deukhoofd 5y ago
When you have multiline strings, and don't want to start the lines with whitespace, it means you need to break the indentation of your code, which can look quite ugly. I'm not sure whether I want the compiler to do it like in the proposal though, I feel like it can easily cause unintentional issues.
- LandR 5y agoWhen I have strings like this, currently I find myself doing something like var foo = "<foo>" + Environment.NewLine + " <bar>" + Environment.NewLine + " <quax>" + Environment.NewLine + "</foo>"; This would fix stuff like this nicely, but it's horrible syntax I think.
- Deukhoofd 5y agoThat would also not be a compile time constant, which would probably be desired in cases like that.
- assbuttbuttass 5y agoI think breaking the indentation is the lesser of two evils, because it becomes very obvious what the content of the string is. I've never minded it too much personally in go, but I guess it's subjective.