- Learn the operators and techniques required to evaluate and compare values in your decision statements.
After you complete this module, you'll be able to:
Use operators to create Boolean expressions that test for comparison and equality.
Use built-in methods to the string class to perform better evaluations on strings.
Use the negation operator to test for the opposite of a given condition.
Use the conditional operator to perform an inline evaluation.
- Use code blocks with more confidence, understanding how they impact the visibility and accessibility of both higher and lower-level constructs in your code.
After you complete this module, you'll be able to:
Understand the impact of declaring and initializing variables inside and outside of code blocks.
Remove code blocks in if statements to improve readability when there's only one line of code in the body of the code block.
Describe the purpose and scoping hierarchy for namespaces, classes, and methods.
- Learn how to add branching logic that matches one variable or expression against many possible values.
After you complete this module, you'll be able to:
Use the switch-case construct to match a variable or expression against several possible outcomes.
Convert code that uses an if-elseif-else construct into a switch-case construct.
- Use the for iteration statement to loop a pre-set number of times and control the iteration process.
After you complete this module, you'll be able to:
Use the for statement to loop through a block of code
Modify how the .NET Runtime executes the looping logic, changing the value of the iterator, the condition and the pattern
- Use the do-while and while statements to iterate as long as a Boolean expression evaluates to true.
After you complete this module, you'll be able to:
Write code that uses the do-while statement to iterate through a code block
Write code that uses the while statement to iterate through a code block
Use the continue statement to step directly to the Boolean evaluation
- Gain experience developing a console app that implements selection and iteration statements to achieve app specifications.
In this module, you'll practice how to:
Use Visual Studio Code to develop a C# console application that uses a combination of selection and iteration statements to implement logical workflows in accordance with supplied application data and user interactions.
Evaluate the underlying conditions and make an informed decision when choosing between if-elseif-else and switch statements, and between foreach, for, while, and do iteration statements.
Scope variables at an appropriate level within an application.
- Demonstrate your ability to develop a console app that implements selection and iteration statements to achieve app specifications.
In this module, you'll demonstrate your ability to:
Use Visual Studio Code to develop a C# console application that uses a combination of selection and iteration statements to implement logical workflows in accordance with supplied application data and user interactions.
Evaluate the underlying conditions and make an informed decision when choosing between if-elseif-else and switch statements, and between foreach, for, while, and do iteration statements.
Scope variables at an appropriate level within an application.
Master AI & Data—50% Off Udacity (Code CC50)
Gain a Splash of New Skills - Coursera+ Annual Nearly 45% Off
Overview
Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Syllabus
- Evaluate Boolean expressions to make decisions in C#
- Introduction
- Exercise - Evaluate an expression
- Exercise - Implement the conditional operator
- Exercise - Complete a challenge activity using conditional operators
- Review the solution to the conditional operator challenge activity
- Exercise - Complete a challenge activity using Boolean expressions
- Review the solution to the Boolean expressions challenge activity
- Module assessment
- Summary
- Control variable scope and logic using code blocks in C#
- Introduction
- Exercise - Code blocks and variable scope
- Exercise - Remove code blocks from if statements
- Exercise - Complete a challenge activity using variable scope
- Review the solution to the variable scope challenge activity
- Module assessment
- Summary
- Branch the flow of code using the switch-case construct in C#
- Introduction
- Exercise - Implement a switch statement
- Exercise - Complete a challenge activity using switch statements
- Review the solution to the switch statement challenge activity
- Module assessment
- Summary
- Iterate through a code block using for statement in C#
- Introduction
- Exercise - Create and configure for iteration loops
- Exercise - Complete a challenge activity using for and if statements
- Review the solution to the for and if statement challenge activity
- Module assessment
- Summary
- Add looping logic to your code using the do-while and while statements in C#
- Introduction
- Exercise - Create do and while iteration loops
- Exercise - Complete a challenge activity using do and while iteration statements
- Review the solution to do and while challenge activity
- Exercise - Complete a challenge activity to differentiate between do and while iteration statements
- Review the solution to do versus while challenge activity
- Module assessment
- Summary
- Guided project - Develop conditional branching and looping structures in C#
- Introduction
- Prepare
- Exercise - Build sample data and menu selection loops
- Exercise - Write code to display all ourAnimals array data
- Exercise - Build and test a loop for entering new pet data
- Exercise - Write code to read and save new ourAnimals array data
- Module assessment
- Summary
- Challenge project - Develop branching and looping structures in C#
- Introduction
- Prepare
- Exercise - Ensure that petAge and petPhysicalDescription contain valid information
- Exercise - Ensure that pet nicknames and personality descriptions are complete
- Module assessment
- Summary