Author Topic: Toggle = not Toggle that is the question  (Read 4543 times)

0 Members and 3 Guests are viewing this topic.

Mike Lobanovsky

  • Guest
Re: Toggle = not Toggle that is the question
« Reply #15 on: November 29, 2015, 07:15:36 AM »
In Script BASIC, FALSE = 0 and TRUE = -1. TRUE/FALSE are SB keywords with predefined values.

Code: Script BASIC
  1. T = 10
  2. IF T = NOT FALSE THEN
  3.   PRINT T,"\n"
  4. END IF
  5.  

The idea to check anything against literal TRUE or FALSE is surrealistic, numeric representation dependent, and bug prone. I would even call it "bad programming practice".

Instead,

Code: OxygenBasic
  1. N = 10
  2. IF N THEN ' evaluates to TRUE for any N except N = 0 in any language
  3. ....

and

Code: OxygenBasic
  1. N = 0
  2. IF NOT N THEN ' evaluates to TRUE only for N = 0 in any language
  3. ....

is independent of actual numeric representation of TRUE in a language, be it -1 or +1 or -1M or +1M, whatever.

The only practical case of seeing what TRUE evaluates to numerically in a given language I ever needed was

Code: OxygenBasic
  1. A = 10: B = 10
  2. PRINT A = B ' would print -1 in O2 and SB but 1 in FBSL, C/C++/C#, VB6, VB.NET, etc.
  3. ....

OT

Quote
As to the discussion on BP.org about language popularity, PHP and JavaScript are the most widely used languages in todays computing. The desktop is no longer king.

I think your sentence definitely misses a tongue smiley. ;) As far as I am concerned, flooding the world with web pages generated from templates in WYSIWYG IDEs for handheld gimmiks and wifi aware dishwashing machines has nothing to do with computing.

The entire world order could have worked in the exact same way if there were IUP instead of HTML, C instead of PHP, and SB instead of JS. You have overslept your glory moments, John.
« Last Edit: November 29, 2015, 07:27:34 AM by Mike Lobanovsky »

JRS

  • Guest
Re: Toggle = not Toggle that is the question
« Reply #16 on: November 29, 2015, 10:50:11 AM »
Quote
The entire world order could have worked in the exact same way if there were IUP instead of HTML, C instead of PHP, and SB instead of JS. You have overslept your glory moments, John.

Actually you're not too far off with my real life project converting Sage 100 accounting to Linux.