C# Block Statement({})

In this chapter you will learn:
  • What is Block Statement in C#?
  • How to use Block Statement in C#?

The block statement is used to write multiple segments of the program in the logical group.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace run_csharp_code
{ //Begin Statement
    class Program
    { // Begin Statement
        static void Main(string[] args)
        { //Begin Statement
            int num1, power;
            num1 = 5;
            power = num1 * num1;
            Console.WriteLine(power);
            Console.ReadLine();
        } // End Statement
    } // End Statement
} // End Statement

Summary

In this chapter you learned what is block statement in C#. In next chapter you will learn Empty statement in C#.

More Articles

 

Share your thought