Skip to Main Content
C# 10.0 All-in-One For Dummies
book

C# 10.0 All-in-One For Dummies

by John Paul Mueller
March 2022
Intermediate to advanced content levelIntermediate to advanced
864 pages
19h 46m
English
For Dummies
Content preview from C# 10.0 All-in-One For Dummies

Chapter 5

Getting into the Program Flow

IN THIS CHAPTER

Bullet Making decisions if you can

Bullet Deciding what else to do

Bullet Using the while and do … while loops

Bullet Using the for loop and understanding scope

Consider this simple program:

using System;namespace HelloWorld{ public class Program { // This is where the program starts. static void Main(string[] args) { // Prompt user to enter a name. Console.WriteLine("Enter your name, please:"); // Now read the name entered. string name = Console.ReadLine(); // Greet the user with the entered name. Console.WriteLine("Hello, " + name); // Wait for user to acknowledge the results. Console.WriteLine("Press Enter to terminate … "); Console.Read(); } }}

Beyond introducing you to a few fundamentals of C# programming, this program is almost worthless. It simply spits back out whatever you entered. You can imagine more complicated program examples that accept input, perform some type of calculations, generate some type of output (otherwise, why do the calculations?), and then exit at the bottom. However, a program such as this one can be of only limited use. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 9781119839071Purchase Link