|
回覆: 問個笨笨的問題
引用: 最初由 abelchang 發表
請問 為何 下列兩式 都造成 "語法錯誤"呢?
if islastbar=1 then KK=MA(C,1);
if islastbar then KK=MA(C,1);
if 後不能放邏輯函數嗎??
可以放的, 語法錯誤是因為
islastbar 其是數列不能直接帶入 IF .... THEN 之條件式中, 需為單值數值才可帶入
if...then 教學請見
http://www.chiefox.com.tw/bbs/showt...=&threadid=2646
if ... then 若要與數列搭配, 必須採用單一元素方式存取(通常需搭配迴圈)
例如:
for i=lbound(KK) to datacount do begin
if KK[i] then begin
......
end;
end;
奇狐的另一種 IF
if(Cond,A,B) 則可應用於整個數列( 其中的 Cond,A,B 這三者都可為數列)
|