C
C#9mo 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
Angius9mo ago
How did you try \n exactly? @Eli
Eli
EliOP9mo ago
Well idk i tried it in many ways how would you suggest i use it?
MODiX
MODiX9mo 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
Angius9mo 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
EliOP9mo 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
Angius9mo ago
\n is an escape character for "new line", that's what it inserts Just like \t does a tab, for example
MODiX
MODiX9mo 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
Angius9mo ago
For future reference
Eli
EliOP9mo ago
Thnx pookie :D
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX9mo ago
Use the /close command to mark a forum thread as answered
Eli
EliOP9mo ago
$close
MODiX
MODiX9mo ago
Use the /close command to mark a forum thread as answered
Want results from more Discord servers?
Add your server