伪代码如下:
if A
then B
if C
then D
else
then E
else
then E
B、D、E 包括几行。我们可以看到这里的“else”重复了两次。如何去除重复代码并保持功能?不要使用“goto”。
最佳答案
只是让它们成为一个函数。即
void E() {
... Your several lines of code here
}
关于c - 如何删除这个重复的 else 语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18627064/