2 C# Programming Basics

2.1 Variables

2.2 Assignment

2.3 Input and Output

2.4 Arithmetic Expressions

2.5 Methods and Parameters

I n this chapter we will learn about the basic elements of a simple C# program. We use integer values and variables to represent storage locations. Identifiers name variables and other program elements. The assignment statement lets us assign a value to a variable. Expressions compute values. We study arithmetic expressions built using arithmetic operators. Precedence rules permit less use of parentheses in expressions. Input and output methods communicate between the user and the computer. A method implements a computation or an action. We learn to create our own methods, passing parameters and returning values.

Get Computing with C# and the .NET Framework, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.