aseba icon indicating copy to clipboard operation
aseba copied to clipboard

Is there a bool type or not? Clarify documentation

Open motib opened this issue 8 years ago • 1 comments

There is confusion on the issue of bool types. On the one hand, types are not declared, nor are the boolean values true and false. On the other hand, an attempt to use the logical operator not leads to an error on bool types. At the very least, the documentation should clarify that (apparently) comparison operators return 0 or 1 not that they return true or false, and the logical operators defined appropriately.

var found

found = false # Error: false is not a defined variable

found = 0 if not found then # Error: expecting bool type [!!!], found integer type instead end

motib avatar Aug 18 '16 08:08 motib

Boolean types are not user-declarable, but they exist in the grammar. They are the return type of comparisons and logical operations, and the input types of flow control operators. Feel free to clarify the documentation accordingly if you see have way to make it more clear :-)

stephanemagnenat avatar Aug 22 '16 08:08 stephanemagnenat