Monday, 19 September 2016

Coming Soon - Blogs

How to Startup Using Node.JS?
- Installation
- Usage for .NET developers
- Setting up a simple project and run
- Features Listings

C#
- Concurrent Collections
- Latest Features
- Latest Version
- Multithreading
- Memory Profiling

SQL
- Latest Features
- Latest Version
- Query Optimization

Angular JS
- Study Guide
- List of things to Learn

TDD
- How to start up
- List of things to Learn
- Application for Dev or Support Project
- Hands on Experience

Thursday, 15 September 2016

C# - Difference between Continue & Break Statement


While working through the code i found wondering myself what exactly is the "continue" keyword means. Although its usage is pretty less these days but it is better to know stuff than not.

So, the below sample code will explain the difference between Continue & Break Statement in C#. You can read the comment or see the Output to understand it.
The code can also be found at My Code Fiddle (You can run it, to see it)


using System;
public class Program
{
    public static void Main()
    {
        for(int i = 1; i < 6; i++)
        {
            //continue is like a special break statement in which
// instead of jumping off loop block, 
//the current loop iteration(n) is treated as completed. 
//The execution is then forced to start with the next iteration(n+1) loop.
            if(i == 4)        
                continue;
            Console.WriteLine(i);
        }
        
        Console.WriteLine("Loop A is Completed");
        Console.WriteLine();
        
        for(int i = 1; i < 6; i++)
        {
            //The break statement will make the execution jump off loop block.
 //No more iteration(n+1) loop will be respected. 
            if(i == 4)        
                break;
            
            Console.WriteLine(i);
        }        
        Console.WriteLine("Loop B is Completed");
    }
}

Output:
1
2
3
5
Loop A is Completed

1
2
3
Loop B is Completed


My First Blog "Hello World"

My First Blog "Hello World".

www.LifeAsTechie.blogspot.com

using System;
public class StartUp
{
public static void Main(string[] args)
{
Console.Write("Hello World");
}
}