How to use 'google sheets foreach' in Go

Every line of 'google sheets foreach' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
888func (lq *LinqObj) ForEach(line string, scope *Scope, args ...Object) Object {
889 if len(args) != 1 {
890 return NewError(line, ARGUMENTERROR, "1", len(args))
891 }
892
893 block, ok := args[0].(*Function)
894 if !ok {
895 return NewError(line, PARAMTYPEERROR, "first", "forEach", "*Function", args[0].Type())
896 }
897
898 s := NewScope(scope, nil)
899
900 next := lq.Query.Iterate()
901
902 for item, ok := next(); ok.Bool; item, ok = next() {
903 s.Set(block.Literal.Parameters[0].(*ast.Identifier).Value, item)
904 Eval(block.Literal.Body, s)
905 }
906
907 return NIL
908}

Related snippets