Output value via string interpolation - CSharp Language Basics

CSharp examples for Language Basics:string

Description

Output value via string interpolation

Demo Code

using static System.Console;
class Program//from  www  .j  a  v  a  2 s  . c om
{
   static double Add(double a, double b)
   {
      return a + b; // deliberate bug!
   }
   static void Main(string[] args)
   {
      double a = 4.5; // or use var
      double b = 2.5;
      double answer = Add(a, b);
      WriteLine($"{a} + {b} = {answer}");
   }
}

Result


Related Tutorials