C# C# Basics If Statements Comparison Operators

Cody Fisher
Cody Fisher
11,884 Points

String interpolation using the syntax $"{} some words ${}"

This video shows the total being printed out with this statement:

Console.WriteLine($"For {quantity} cans, your total is: $(total)");

I tried both with and without the second $ character and omitting it does not seem to have any effect. Is there a syntactical reason for including the second $ character?

1 Answer

What is the difference between parentheses for fist and second var? There is a problem with your brackets. Use $ only before " of your string.