Global accumulators can be declared anywhere in the query. Vertex-attached accumulators can be declared anywhere in the query except for in a
FOREACH loop or
WHILE loop. Accumulators are block-scoped and can only be accessed in the block where they are declared.
That is, you can declare global and local accumulator after some query blocks (e.g. SELECT statement). The query blocks that after the declaration can see the accumulator.