Acknowledged

"char --" or "char -= 1" error

I noticed recently you can increment a Char but you can't decrement a Char.

 var foo = 'A';
foo ++;

The above is fine and `foo` is now 'B'. But in the below:

 var foo = 'B';
foo --;

The second line fails to compile with error: Cannot perform operation 'sub' on types '$.Toybox.Lang.Char' and '$.Toybox.Lang.Number'.

foo -= 1;

Also fails. Tested in SDK 8.0.0 beta.

This looks like a simple bug/oversight and should probably be fixed.

Parents Comment Children
No Data