C
C#8mo ago
Eli

✅ String interpolation next line

So i tried \n but it just gives errors. Does anyone know how i can print the amount1 on the next line without writing 2 seperate console writelines??
No description
13 Replies
Angius
Angius8mo ago
How did you try \n exactly? @Eli
Eli
Eli8mo ago
Well idk i tried it in many ways how would you suggest i use it?
MODiX
MODiX8mo ago
Angius
REPL Result: Success
var (a, b, c) = ("hello", "goodbye", "foobar");
Console.WriteLine($"{a}\n{b}\n{c}");
var (a, b, c) = ("hello", "goodbye", "foobar");
Console.WriteLine($"{a}\n{b}\n{c}");
Console Output
hello
goodbye
foobar
hello
goodbye
foobar
Compile: 465.415ms | Execution: 33.523ms | React with ❌ to remove this embed.
Angius
Angius8mo ago
Alternatively,
var (a, b, c) = ("hello", "goodbye", "foobar");
Console.WriteLine($"""
{a}
{b}
{c}
""");
var (a, b, c) = ("hello", "goodbye", "foobar");
Console.WriteLine($"""
{a}
{b}
{c}
""");
Eli
Eli8mo ago
Im not that smart huh alr thnx so much This one worked perfectly i just assumed it would lituarily print \n but it doesnt tysm
Angius
Angius8mo ago
\n is an escape character for "new line", that's what it inserts Just like \t does a tab, for example
MODiX
MODiX8mo ago
Angius
REPL Result: Success
"\t\tlike so"
"\t\tlike so"
Result: string
like so
like so
Compile: 134.384ms | Execution: 16.687ms | React with ❌ to remove this embed.
Angius
Angius8mo ago
For future reference
Eli
Eli8mo ago
Thnx pookie :D
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX8mo ago
Use the /close command to mark a forum thread as answered
Eli
Eli8mo ago
$close
MODiX
MODiX8mo ago
Use the /close command to mark a forum thread as answered
Want results from more Discord servers?
Add your server