Whats wrong with my code? :(

Hey guys,

idk if this is the right place to ask but,
does anyone know what is wrong there?

It says: “unexpected token else”

Thank you!

slider = effect("Einstellungen für Schieberegler")("Schieberegler")

sec = slider%60;
minu = Math.floor(slider/60)%60;
hour = Math.floor(slider/3600);

function addZero(n) {
if (n < 10) return "0" + n else return n
}

addZero(hour) + ":" + addZero(minu) + ":" + addZero(sec)

what you attempt to use is called the ternary operator, so googling something like: python ternary operator, should help :slight_smile: Good luck, let me know if you need more help.

your syntax is slightly off, it should be:

return "when true" if condition else "when false"
6 Likes