C# Empty Statement(;)

semicolon-twitter-com
In this chapter you will learn:

  • What is Empty Statement in C#?
  • How to use Empty Statement in C#?
  • What is the benefit of using Empty Statement in C#?

Empty statement is used when you no need to perform an operation where a statement is required. It simple transfers control to the end point of the statement. It is also very useful with while loop with blank body and label statements.

Example:


Note: It processes infinite loop so terminating the program press ctrl+c.

Output

Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
Steven Clark
__

Summary

In this chapter you learned about empty statement in C#. You also learned how to use empty statement in C# programming. In next chapter you will learn about goto statement in C#.



4 thoughts on “C# Empty Statement(;)”

    1. Because, It initiate Infinite loop. Press Ctrl + c to terminate the program. Put this code and you won’t get Fatal Error.

Leave a Reply

Your email address will not be published. Required fields are marked *