0.3.12 Stepping Over Code With F10

A Breakpoint Gives You a Starting Point

A breakpoint pauses the program at a useful location.

Once the program is paused, you may want to watch the next few statements execute one at a time.

Visual Studio's Step Over command is designed for that.

The common keyboard shortcut is:

F10

Step Over lets you advance through the current sequence while staying focused on the current level of code.

One Step Changes the Execution Point

Imagine the program is paused before these statements:

C#
player1.name = "Jordan";
player1.isAvailable = true;

Before the first statement executes, the name may still have its earlier value.

Press F10 once.

Visual Studio executes the current statement and moves to the next statement.

Now the assignment to name has occurred.

Press F10 again.

The availability assignment executes.

This makes sequence visible.

Instead of only reading:

first this, then this

you can observe the state change after each step.

Predict Before You Press F10

Stepping becomes more useful when you make a prediction first.

Suppose execution is paused before:

C#
player1.isAvailable = true;

Predict:

After I step over this line, isAvailable should be true.

Then press F10 and inspect the value.

If the observation matches the prediction, your understanding of that statement is supported.

If it does not, investigate the difference.

The debugger becomes a learning tool when you compare expected and actual state.

Step Over Follows the Current Flow

If the next statement is part of the path the program is actually taking, Step Over moves execution forward.

Later, when you encounter conditional logic, the next highlighted statement may reveal which path was selected.

For now, keep your attention on:

“Over” Does Not Mean “Skip the Statement”

Step Over still executes the current statement.

The word over becomes more important when the current line contains a method call.

Step Over allows that called method to run without taking you line-by-line through the inside of the method.

Detailed method stepping comes later in the programming sequence.

At this stage, use F10 to remain focused on the current flow.

Watch One Value Change

A useful first stepping exercise is to follow a field through several assignments.

For example:

C#
player1.jerseyNumber = 7;
player1.jerseyNumber = 9;

Pause before the first assignment.

Observe the current value.

Press F10.

Observe the value again.

Press F10.

Observe it again.

The final state reflects the statements that have executed most recently.

This connects code sequence directly to object state.

Use F10 Around a Decision

Suppose the source contains a simple decision provided by the course.

Pause immediately before the condition is evaluated.

First inspect the Boolean information involved.

Then use F10.

Watch which statement Visual Studio highlights next.

That movement through the source is runtime evidence about the path the program selected.

You do not need to guess based only on indentation.

You can see the actual execution path.

Do Not Step Without a Question

It is possible to press F10 repeatedly until the program finishes.

That often produces a lot of movement without much learning.

Use Step Over when you want to answer something specific, such as:

A debugging command is most useful when it serves an investigation.

F10 Fits Into a Larger Workflow

A simple tracing process is:

  1. Read the requirement or diagram.
  2. Predict the expected path or value.
  3. Set a breakpoint at a useful starting point.
  4. Run to the breakpoint.
  5. Inspect the current state.
  6. Press F10 to execute one statement at a time.
  7. Observe what changes.
  8. Compare the observed flow with your prediction.

This is the foundation of tracing program execution.

Later you will add commands that step into method calls, step out of methods, and continue execution more strategically.