Introduction

Many of the applications that you’ll build in C# will require you to work with data. Sometimes that data will be hard-coded in your application. Hard-coded values are values that are constant and unchanged throughout the execution of the program. For example, you may need to print a message to the user when some operation succeeds. A “success” message would likely be the same every time the application is executed. This hard-coded value can also be called a constant, or a literal value.

Suppose you want to display a formatted message to the end user containing different types of data. The message would include hard-coded strings combined with information your app collects from the user. To display a formatted message, you’ll need to create both hard-coded values and define variables that can store data of a certain type, whether numeric, alphanumeric, and so on.

In this module, you’ll create literal values that contain different data types. You’ll create variables that can hold certain data types, set those variables with a value, then retrieve those values later in code. And finally, you’ll learn how you can simplify your code by allowing the compiler to shoulder some of the work.

By the end of this module, you’ll be able to create literal values and store and retrieve data in variables.

Learning objectives

In this module, you will:

  • Create literal values for five basic data types
  • Declare and initialize variables
  • Retrieve and set values in variables
  • Allow the compiler to determine the data type for your variable when initializing

Prerequisites

  • Must understand basic C# syntax rules
  • Must understand how to useĀ Console.WriteLine()
  • Beginner level experience with a .NET editor

software development training courses malaysia

Leave a Reply

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