1

I am very new at programming in Google Script, and need some guidance here.

I have a loop that is supposed to check the value of a range, then move down to the next row and set the new range's value as "next", which is then compared to "team".

If the condition is met then "team" is given the same value from the range that "next" was given, and "next" is given the value of the range below the current one.

The purpose is to find how many entries there are that meet conditions in a column, then my other parts of the code manipulate that data.

When the "team" value isn't the same as "next" (the value of the range below the current one), then the loop is supposed to stop, but doesn't. Code:

while (team = next) {
  team = orange.getValue();
  row ++; 
  range = col + row.toString();
  orange = ordered.getRange(range);
  next = orange.getValue();
  entries ++;
  };
2
  • Welcome to StackOverflow. When posting questions, please keep in mind that it is often hard to read one big block of text. Breaking up your question into separate paragraphs is usually the way to go. Commented Jan 31, 2014 at 1:58
  • I'm not familiar with Google Script, but do you have a way to message box(aka "pop-up" or write to terminal or even to a scratch column) the value of team and next at the end of each iteration of the loop? Commented Jan 31, 2014 at 22:35

1 Answer 1

2

I'm not familiar with Google Script either, but most languages require double equal sign for equality tests. From a cursory view I think Google Script uses the same syntax. Try doing this instead:

while (team == next)

Notice the double == to check for equality instead of single = to assign a variable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.