C
C#β€’3w ago
hutonahill

βœ… whats up with this console output

Value
yellowThresholdWidth == 195.42857142857144
redThresholdWidth == 684
barWidth == 760
Value
yellowThresholdWidth == 195.42857142857144
redThresholdWidth == 684
barWidth == 760
Console.WriteLine($"Value " +
$"\nyellowThresholdWidth == {yellowThresholdWidth} " +
$"\nredThresholdWidth == {redThresholdWidth}" +
$"\nbarWidth == {barWidth}");
Console.WriteLine($"Value " +
$"\nyellowThresholdWidth == {yellowThresholdWidth} " +
$"\nredThresholdWidth == {redThresholdWidth}" +
$"\nbarWidth == {barWidth}");
93 Replies
hutonahill
hutonahillβ€’3w ago
why is this adding so many tabs!? it makes no since. this is super simple but broken the new line somehow adds space chars equal to the number of chars before the line break smells like a bug
SG97
SG97β€’3w ago
what do you mean?
No description
hutonahill
hutonahillβ€’3w ago
No description
SG97
SG97β€’3w ago
cannot reproduce that
hutonahill
hutonahillβ€’3w ago
yea i am soo screwed
MutableString
MutableStringβ€’3w ago
is that rider? maybe there's a setting for newline
hutonahill
hutonahillβ€’3w ago
possible. will check that out
cap5lut
cap5lutβ€’3w ago
that looks a lot like that the console (the tab, not the class) expects a \r\n but Console.WriteLine() only writes a \n for some reason. \r = CR = Carriage Return, moves the cursor back to the line start (as in x = 0, if u will) \n = NL = New Line, move to the next line (as in y + 1, if u will) if u execute it from terminal/console outside of the IDE, does it work there as expected?
canton7
canton7β€’3w ago
The "some reason" is that their string contains "\n" -- they're only calling Console.WriteLine once And seconded, this is exactly the output when you send "\n", but the terminal doesn't add an implicit "\r" with every "\n"
cap5lut
cap5lutβ€’3w ago
oh right
Unknown User
Unknown Userβ€’3w ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiXβ€’3w ago
TeBeCo
REPL Result: Success
using System;

var yellowThresholdWidth = 1;
var redThresholdWidth = 2;
var barWidth = 3;

Console.WriteLine($"""
Value
yellowThresholdWidth == {yellowThresholdWidth}
redThresholdWidth == {redThresholdWidth}
barWidth == {barWidth}
""");
using System;

var yellowThresholdWidth = 1;
var redThresholdWidth = 2;
var barWidth = 3;

Console.WriteLine($"""
Value
yellowThresholdWidth == {yellowThresholdWidth}
redThresholdWidth == {redThresholdWidth}
barWidth == {barWidth}
""");
Console Output
Value
yellowThresholdWidth == 1
redThresholdWidth == 2
barWidth == 3
Value
yellowThresholdWidth == 1
redThresholdWidth == 2
barWidth == 3
Compile: 480.701ms | Execution: 30.757ms | React with ❌ to remove this embed.
Unknown User
Unknown Userβ€’3w ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiXβ€’3w ago
TeBeCo
REPL Result: Success
using System;

var yellowThresholdWidth = 1;
var redThresholdWidth = 2;
var barWidth = 3;

Console.WriteLine($"""
Value
yellowThresholdWidth == {yellowThresholdWidth}
redThresholdWidth == {redThresholdWidth}
barWidth == {barWidth}
""");
using System;

var yellowThresholdWidth = 1;
var redThresholdWidth = 2;
var barWidth = 3;

Console.WriteLine($"""
Value
yellowThresholdWidth == {yellowThresholdWidth}
redThresholdWidth == {redThresholdWidth}
barWidth == {barWidth}
""");
Console Output
Value
yellowThresholdWidth == 1
redThresholdWidth == 2
barWidth == 3
Value
yellowThresholdWidth == 1
redThresholdWidth == 2
barWidth == 3
Compile: 506.782ms | Execution: 30.704ms | React with ❌ to remove this embed.
Unknown User
Unknown Userβ€’3w ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server