目的
隨著開逐漸頻繁,我們就會產生非常多的程式碼內容,之後要如何將程式碼做有效的留存?如何要轉交給下一位同仁時能夠更快能夠更快上手。
爲什麼要排版
提高可讀性
減少錯誤
便於合作
提高維護
實際範例
修改前
public class Example {
public static void main(String[] args) {
int a = 10;
int b = 20;
if (a > b) {
System.out.println("a is greater");
} else {
System.out.println("b is greater");
}
}
}
修改後
public class Example {
public static void main(String[] args) {
int a = 10;
int b = 20;
if (a > b) {
System.out.println("a is greater");
} else {
System.out.println("b is greater");
}
}
}