用于更新列表中的数据,或者来自路径的组件,或者来自聚合的结果
foreach 括号中的变量是与外部分开的,变量不能用于语句之外
foreach 括号里可以执行任何更新命令,create / create unique / delete / foreach
// 将设置路径上所有的节点的 flag 属性为 true
match p = (begin) -[*]-> (end)
where begin.name='a' and end.name = 'z'
foreach (n in nodes(p) | set n.flag = true )
// 将列表中的人全部加为 朋友
match (a:User)
where a.userId = 1
foreach ( name in ['a','b','c'] | create (a) --> (:User{name:name}) )