I'm attempting to use the JS from this post — in an Arcade calculation attribute rule: Code Review: Modify Polyline Vertices
That script uses the following for loop:
//This script works as standalone JS: https://jsfiddle.net/x4su7tna/
var paths = [[[0,5,null],[10,10, null],[30,0, null],[50,10, null],[60,10, null]]]
for (var path of paths) {
return
}
ERROR 002717:
Invalid Arcade expression, Arcade error: Syntax error in for loop, Script line: 32760
I get that error when I try to save the attribute rule. I think the for loop is the culprit: for (var path of paths) {
If I replace that for loop with for (var path_idx in paths) { , then I can successfully save:
var paths = [[[0,5,null],[10,10, null],[30,0, null],[50,10, null],[60,10, null]]]
for (var path_idx in paths) {
return
}
Question:
Why do I get an error when I use for (var path of paths) { ?
In Arcade, the syntax of a for loop doesn't use "of", only "in".