#602. List length
When the green flag is clicked, this script runs. What number will the cat say?
when green flag clicked delete all of [colors v] add [red] to [colors v] add [blue] to [colors v] add [white] to [colors v] add [green] to [colors v] delete (1) of [colors v] delete (1) of [colors v] say (length of [colors v])
colors = []
# When the green flag is clicked
colors.clear()
colors.append("red")
colors.append("blue")
colors.append("white")
colors.append("green")
del colors[0]
del colors[0]
print(len(colors))
const colors = [];
// When the green flag is clicked
colors.length = 0;
colors.push("red");
colors.push("blue");
colors.push("white");
colors.push("green");
colors.splice(0, 1);
colors.splice(0, 1);
console.log(colors.length);
💡 Not sure? Build it in Scratch and try it out.