Monday, April 2, 2018

C Lesson 6 Declaring Variables and Assigning Values Duration

C Lesson 6 Declaring Variables and Assigning Values Duration


Here, we start adding C# syntax to your vocabulary by talking about fundamental building blocks: data types and variables. We also discuss basic topics, such as naming conventions and data type conversions.

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

namespace Variables
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            int x;
            int y;

            x = 7;
            y = x + 3;
            Console.WriteLine(y);
             */

            //string myFirstName;
            //myFirstName = "Bob";

            //string myFirstNane = "Bob";

            //var myFirstName = "Bob";
            //var myFirstName = "";

            //string myfirstname;

            //Console.WriteLine(myFirstName);


            int x = 7;
            //string y = "Bob";
            string y = "5";
            string myFirstTry = x.ToString() + y;

            //int mySecondTry = x + y;
            int mySecondTry = x + int.Parse(y);

            Console.WriteLine(myFirstTry);
            //Console.WriteLine(mySecondTry);


            Console.ReadLine();

        }
    }
}

Source : MS Virtual Academy



visit link download