Error Lab
Every diagnostic below is the real output of ptc, not a mock-up. Pick a mistake, read how the compiler teaches the canonical form, then flip to the fix.
No compound assignment
x += 1 hides a read and a write in one operator, and its family differs between languages (++, +=, ||=). POLYTONE has one assignment form; the error says how to write it out.
mut count = 0
for x in [3, 4]:
count += x
print("{count}")The compiler answers
error: there is no compound assignment — write it out: 'x = x + 1' (line 3, column 12)mut count = 0
for x in [3, 4]:
count = count + x
print("{count}")Fixed — and it runs
7