Udostępnij za pośrednictwem


Small Basic: Relational Operators & Strings

The Other Relational Operators

Small Basic was designed to strip out as much as it can (it isn’t called Big Complex). So the other relational operators (<, <=, >, and >=) aren’t defined for strings. If you use any these operators with non-numeric strings, the result will always be false. But being able to compare strings for equality (or inequality) will meet your basic needs.

Some programming languages let you write expressions like ("carriage" < "cat"), and they return true for this expression because "car" (the first three letters in carriage) comes before "cat" in the dictionary. Small Basic decided against this. So if your program needs you to sort strings based on their alphabetical order, you’ll need to do the sorting yourself.

Learn more about Small Basic here:

https://blogs.msdn.com/SmallBasic

 

Small and Basically yours,

   - User Ed & Majed Marji

Comments