ループの例
- Last UpdatedSep 26, 2024
- 1 minute read
以下のスクリプトは、簡単なループおよび間接タグ変数を使用して、100 のタグ変数(Tag001 ~ Tag100)を値 0 で再初期化します。
DIM Counter AS INTEGER;
FOR Counter = 1 TO 100
IndirectInteger.Name = "Tag" + Text(Counter, "000");
IndirectInteger.Value = 0;
NEXT;
以下のスクリプトは、2 つの入れ子ループおよび間接タグ変数を使用して、1000 のタグ変数(Line01_Tag001 ~ Line10_Tag100)を値 0 で再初期化します。
DIM LineCounter AS INTEGER;
DIM TagCounter AS INTEGER;
FOR LineCounter = 1 TO 10
FOR TagCounter = 1 TO 100
IndirectInteger.Name = "Line" + Text(LineCounter, "00") + "_Tag" + Text(TagCounter, "000");
IndirectInteger.Value = 0;
NEXT;
NEXT;