试图在系列变量分配期间引用以前的值?

Trying to reference previous value during series variable assignment?

我想做以下事情:

thisSeries = 
  someCondition ? 1 
  : someOtherCondition ? -1 
    : thisSeries[1]

如果两个条件都不满足,我需要重复previousValue: thisSeries[1]

我遇到错误:

Undeclared identifier 'thisSeries'

我该怎么做?

从v2开始,任何使用递归的变量都必须事先声明。

thisSeries = 0
thisSeries := someCondition ? 1 : someOtherCondition ? -1 : thisSeries[1]

首先,变量被声明为整数,然后我们使用赋值运算符重新声明它:=