I just realised that
If a And b Or Not a And Not b Then

Could be simplified as:
If a=b Then

Ronald Vogelaar
http://www.rovosoft.com



----- Original Message ----- From: "Ronald Vogelaar" <[EMAIL PROTECTED]>
To: "REALbasic NUG" <[email protected]>
Sent: Thursday, October 12, 2006 12:09 PM
Subject: Language addition proposals


Hi all,

Having worked with and studied the REALBasic language for a couple of years now, there are a number of functions that I found 'missing'. Please understand me well, I have no baggage of knowledge about any other programming language to speak of that could otherwise have generated a 'need' for these functions. The need is a purely practical one.
I did look up function names to make sure I'd name them properly.

Also, all of these functions can be performed by alternatives with relative ease, much in the same way a '+' could be performed by using '--' (two minus signs; thus: 1--1 equals 1+1. Try it, it works.)
In the descriptions bExp1 and bExp2 are Booleans.

NOR
Returns True if both bExp1 and bExp2 are False
Example:
 If a Nor b Then
Now:
 If Not a And Not b Then

XOR
Returns True if only one of bExp1 and bExp2 is False
Example:
 If a XOR b Then
Now:
 If Not a And b Or a And Not b Then

XNOR
Returns True if both bExp1 AND bExp2 are True or False
Example:
 If a Xnor b Then
Now:
 If a And b Or Not a And Not b Then

NAND
Returns True if either one, or both bExp1 and bExp2 are False
Example:
 If a Nand b Then
Now:
 If Not a Or Not b Then


IIF( bExp As Boolean, sText1 As String, sText2 As String ) As String
Returns sText1 if bExp is True, if false it returns sText2
Example:
 Dim s As String = IIF( a, "one", "two" )
Now (short as possible):
 Dim s As String
 If a Then s="one" Else s="two"

Personally, I wouldn't have used an If-Then oneliner in the last example, so my own gain is 5 lines there. Should have alternatives for returning other datatypes as well. (Please, no Variants to 'solve' this!)


I have more examples, but I don't think they'd get many votes. However, these I listed here make sense, since they mean you have to type less while maintaining readability of your code. Personally, I think they make sense, syntaxically, logically as well as linguistically.

Yeah or nay?

Ronald Vogelaar
http://www.rovosoft.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

__________ NOD32 1.1798 (20061011) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to