> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/debugging-tools-experience/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/debugging-tools-experience/422chu-cuo-gong-ju/4221visual-studio/2215dan-bu-zhen-cuo.md).

# 5.1.5.單步執行程式

## 1.用途

* 1.用[中斷點](https://jenhsuan.gitbooks.io/debugging-tools-experience/content/chapter4-fu-zhi-wen-ti-de-ji-qiao/42zhui-zong-cheng-shi-zhi-xing/422chu-cuo-gong-ju/4221shu-chudebug-xun-606f3a-visual-studio.html)跨過大區塊後, 小心檢查每一行以找尋常見的錯誤, 特別是沒有遵循必要慣例的程式
  * 運算元優先順序錯誤
  * 遺漏的括號
  * 遺漏的break敘述
  * 多餘的分號
  * 使用了**指派**並非**比較**
  * 未初始化或初始化錯誤的變數
  * 迴圈中遺漏的陳述
  * 零基錯誤
  * 錯誤的型別轉換
  * 遺漏的方法
  * 拼字錯誤
  * 語言陷阱
* 2.寫下關鍵變數的名稱, 以電腦順序執行陳述, 每當數值改變時劃掉舊值寫下新值

## 2.用法

* 單步執行程式有三種: Step Into, Step Over, Step Out

  ![](https://github.com/jenhsuan/debugging-tools-experience/tree/91ad7a157f155ea77065c5600800bb4627bd1ae2/assets/螢幕快照%202017-06-27%20下午2.40.08.png)

  * 1.Step Into
    * 每點一次Step Into程式就執行一步, 若遇到函式則會自動進入
  * 2.Step Over
    * 每點一次Step Over程式就執行一步, 若遇到函式會執行完該函式, 但不會進入函式
  * 3.Step Out
    * 將指標回到上一層函式中
