From cd6b7894162fbb76a9e7e1120dcd2fc2f0a4091e Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Wed, 11 Nov 2020 00:27:29 +0100 Subject: [PATCH] Document explicit bool conversions --- docs/lang/types.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/lang/types.md b/docs/lang/types.md index ff0e1d21..c8d11143 100644 --- a/docs/lang/types.md +++ b/docs/lang/types.md @@ -69,6 +69,14 @@ or forcing zero extension or sign extension: x = y // does zero extension and assigns value $0080 x = sbyte(y) // does sign extension and assigns value $FF80 +You can also explicitly convert expressions of type `bool` to any numeric type. +`false` is converted to 0 and `true` is converted to 1. + + byte a,b,c + a = 5 + b = byte(a == 4) // b is now equal to 0 + c = byte(a == 5) // c is now equal to 1 + ## Typed pointers For every type `T`, there is a pointer type defined called `pointer.T`.