So here is my google apps script without the block comment on top:
function GET_POSITION(game,position) {
defaultsheets=['Stats','Games','Calculations'];
var sheets=SpreadsheetApp.getActiveSpreadsheet().getSheets();
sheets.forEach(function(sheet) {
name=defaultsheets.indexOf(sheet.getName())==-1;
return false;
if(name)
{
name='test';
}
});
return name;
}
Yes I know, this is a weird script and it does not do anything.That is because I kept changing it trying to find out why it would not work.
But that is not the problem. I would expect this script to return false. It does not, it returns true. But when i remove the "return false" it still wont run the if statement (it just keeps returning True).
Meaning:
return false gets ignored?
name is equal to true, but when doing if(name), the if statement is not executed.
Putting name="test" at the beginning of the sheet will make the function return "test".
I have no idea why this script is functioning this way.