Learn to Code via Tutorials on Repl.it!

← Back to all posts
C# text formatting
Jakman (449)

What is Text Formatting???

Text Formatting is when text is formated to show something special. In terms of programming, these 'special' tokens will usually be variables or functions that return values.

How To text format in C# :)

ok so this is a string " Hello Dave"
Lets say that instead of "Dave" i wanted to represent it as a variable to keep track of the name easily. this in some cases could slow down typing. First we need a string variable like so string name = "Dave";
Then we need to format a string. This is how you would do so. Console.Write($"Hello {name}"); you start a formated string with a Dollar sign before it. Then when refrencing a variable with a value you enclose it in curly brackets; just like i did with the string variable named "name".
It will output Hello Dave.
As always, if you have any questions ask me.