大师:代码的优化的标准是什么?是运行效率?还是代码量?代码量与运行效率有无关系。
如if语句:
if a = true then
dim n as Integer
for each c as col in tables.cols
n = n + 1
next
if n >= 5 then
Output.Show("好")
else
Output.Show("不好")
end if
else
dim n as Integer
for each c as col in tables.cols
n = n + 1
next
if n >= 5 then
Output.Show("不好")
else
Output.Show("好")
end if
end if
与以下语句有无差别?
dim n as Integer
for each c as col in tables.cols
n = n + 1
next
if n >= 5 then
if a = true then
Output.Show("好")
else
Output.Show("不好")
end if
else
if a = true then
Output.Show("不好")
else
Output.Show("好")
end if
end if
红色部分原来代码,加一个条件判断,用上面的简单,但代码量多一些?是否影响运行效率?