You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/wwl-language/csharp-for/includes/2-exercise-for.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
1
2
On the surface, the `for` statement is another iteration statement that allows you to iterate through a code block and thereby change the flow of execution of your code. However, once we examine how each works, we can better identify the nuances of each iteration statement and when to use them.
2
3
3
4
## What is the `for` statement?
@@ -22,7 +23,7 @@ This module includes hands-on activities that guide you through the process of b
22
23
23
24
1. In the **Open Folder** dialog, navigate to the Windows Desktop folder.
24
25
25
-
If you have different folder location where you keep code projects, you can use that folder location instead. For this training, the important thing is to have a location that’s easy locate and remember.
26
+
If you have a different folder location where you keep code projects, you can use that folder location instead. For this training, the important thing is to have a location that’s easy to locate and remember.
26
27
27
28
1. In the **Open Folder** dialog, select **Select Folder**.
28
29
@@ -32,22 +33,32 @@ This module includes hands-on activities that guide you through the process of b
32
33
33
34
Notice that a command prompt in the Terminal panel displays the folder path for the current folder. For example:
34
35
35
-
```dos
36
+
```PowerShell
36
37
C:\Users\someuser\Desktop>
37
38
```
38
39
39
40
> [!NOTE]
40
41
> If you are working on your own PC rather than in a sandbox or hosted environment and you have completed other Microsoft Learn modules in this C# series, you may have already created a project folder for code samples. If that's the case, you can skip over the next step, which is used to create a console app in the TestProject folder.
41
42
42
-
1. At the Terminal command prompt, to create a new console application in a specified folder, type **dotnet new console -o ./CsharpProjects/TestProject** and then press Enter.
43
+
1. At the Terminal command prompt, to create a new console application in a specified folder, enter the following prompt:
44
+
45
+
```dotnetcli
46
+
dotnet new console -o ./CsharpProjects/TestProject
47
+
```
48
+
49
+
This .NET CLI command uses a .NET program template to create a new C# console application project in the specified folder location. The command creates the CsharpProjects and TestProject folders for you, and uses TestProject as the name of your `.csproj` file.
43
50
44
-
This .NET CLI command uses a .NET program template to create a new C# console application project in the specified folder location. The command creates the CsharpProjects and TestProject folders for us, and uses TestProject as the name of our `.csproj` file.
51
+
If a message is displayed telling you that the files already exist, continue with the next steps. You'll reuse the existing project files.
45
52
46
-
1. In the EXPLORER panel, expand the **CsharpProjects** folder.
53
+
1. In the EXPLORER view, expand the **CsharpProjects** folder.
54
+
55
+
You should see the **TestProject** folder and two files, a C# program file named Program.cs and a C# project file named TestProject.csproj.
56
+
57
+
1. On the Visual Studio Code **File** menu, select **Open Folder**.
47
58
48
-
You should see the TestProject folder and two files, a C# program file named Program.cs and a C# project file named TestProject.csproj.
59
+
1. In the **Open Folder** dialog, select the **CsharpProjects** folder, and then select **Select Folder**.
49
60
50
-
1. In the EXPLORER panel, to view your code file in the Editor panel, select **Program.cs**.
61
+
1. In the EXPLORER view, expand the TestProject folder, and then select **Program.cs**.
51
62
52
63
1. Delete the existing code lines.
53
64
@@ -238,7 +249,7 @@ What if we need to exit the iteration statement prematurely based on some condit
238
249
239
250
### Loop through each element of an array
240
251
241
-
A common usage for the `for` statement is to iterate through an array of elements, especially if you need some control over the manner in which the iteration happens. While the `foreach` iterates through every element of the array, the `for` statement can be tweaked to provide more customization.
252
+
A common usage for the `for` statement is to iterate through an array of elements, especially if you need some control over the manner in which the iteration happens. While the `foreach` iterates through every element of the array, the `for` statement can be tweaked to provide more customizations.
242
253
243
254
1. Use the Visual Studio Code Editor to update your code as follows:
Copy file name to clipboardExpand all lines: learn-pr/wwl-language/csharp-for/includes/3-exercise-challenge-for-statements.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
Code challenges will reinforce what you've learned and help you gain some confidence before continuing on.
1
+
Code challenges reinforce what you've learned and help you gain some confidence before continuing on.
2
2
3
3
## FizzBuzz challenge
4
4
@@ -28,7 +28,7 @@ Here are the FizzBuzz rules that you need to implement in your code project:
28
28
1. Write the code that implements each rule.
29
29
30
30
> [!IMPORTANT]
31
-
> You will need to understand how to use the `%` remainder operator to determine if a number is divisible by another number evenly. We covered this in the module "Perform basic operations on numbers in C#".
31
+
> You need to understand how to use the `%` remainder operator to determine if a number is divisible by another number evenly. We covered this in the module "Perform basic operations on numbers in C#".
32
32
33
33
1. Run your application and verify that your output meets the requirements.
Copy file name to clipboardExpand all lines: learn-pr/wwl-language/csharp-for/includes/4-review-solution-for-statements-challenge.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,4 +132,4 @@ The code should produce the following output from 1 to 100.
132
132
If you were successful, congratulations! Continue on to the knowledge check in the next unit.
133
133
134
134
> [!IMPORTANT]
135
-
> If you had trouble completing this challenge, maybe you should review the previous units before you continue on. All new ideas we discuss in other modules will depend on your understanding of the ideas that were presented in this module.
135
+
> If you had trouble completing this challenge, maybe you should review the previous units before you continue on. All new ideas we discuss in other modules depend on your understanding of the ideas that were presented in this module.
0 commit comments