Question about the Boolean Values representation in the Ring programming language

One of the questions in Ring Group

“The goal of Ring is to be a high-level programming language which is similar with natural languages. But if we look at Boolean expressions, we will find that the output is 1 is it’s true, and the output is false otherwise. I see that this isn’t coherent with its goal. Values like: true – false are more natural.”

The answer

You can use true for 1 and false for 0
when you test the result of Boolean expressions in your code.
Just when you print the value using the see command you will see 1 for (true) and 0 for (false)
Why ?
Because Ring contains only 4 types of variables
(1) Number
(2) String
(3) List
(4) Object
The first type (Number) is used to represent int, double and Boolean values.
The second type (String) is used to represent char, array of characters, date and time.
The third type (List) is used to represent Arrays of one type, Arrays of more than one type, Hash (Dictionary), Tree, etc.
The object can be an object created from a Ring class (Any Class) or just a C Pointer that we get from calling a C/C++ function/method.
Why ?
The Ring is designed to give the programmer/developer the most simple constructs that can be used to do everything. The programmer/developer can customize the language by creating new classes (and use operator overloading) to get more types that he care about according to the problem domain.
Why ?
Because simple is better, and easy to learn and remember!
And this provide flexibility to convert between high level types that can be represented using the same basic type
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s