今天第一次写Delphi代码,老是提示“Constant expression expected”。折腾了2个来小时,才解决这个问题,原来就少了一个begin...end;
太恶心了,错误提示和真正的原因一点都不着边,欲哭无泪啊。

出错代码:
  case param[1][1] of
    'd':
      parts[i] := DateToStr(Date);
    'i':
        parts[i] := '';
        iIndexStart := StrToInt(param[2]); //老提示这里出错
        iIndexPosition := i;
        iIndexLength := StrToInt(param[3]);
    'r':
        parts[i] := '';
        iRndPosition := i;
        iRndLength := StrToInt(param[2]);
    end;

改下后代码:
  case param[1][1] of
    'd':
      parts[i] := DateToStr(Date);
    'i':
      begin
        parts[i] := '';
        iIndexStart := StrToInt(param[2]);
        iIndexPosition := i;
        iIndexLength := StrToInt(param[3]);
      end;
    'r':
      begin
        parts[i] := '';
        iRndPosition := i;
        iRndLength := StrToInt(param[2]);
      end;
    end;

快被它郁闷死了。

相关文章:

  • 2021-12-09
  • 2021-10-09
  • 2021-05-18
  • 2021-12-25
  • 2021-10-22
  • 2021-09-09
  • 2021-06-07
猜你喜欢
  • 2021-12-11
  • 2021-08-26
  • 2021-12-04
  • 2021-08-14
  • 2021-09-08
  • 2021-11-05
  • 2022-12-23
相关资源
相似解决方案