Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QBJS v0.6.0 Release
#22
(11-10-2022, 01:46 PM)a740g Wrote: I have discovered that the following snippet in QBJS outputs different results compared to QB64-PE.

Code: (Select All)
Print 10 + 20
Print 10 Or 20

In QB64-PE, it prints
30
30

And in QBJS, it prints
30
10
This is always going to be a pain in BASIC only because "OR" the conditional operator was never distinguished cleanly from "OR" the logical operator. For example in C you know it's "||" for the former and a single pipe for the latter. It's distinguishable in Purebasic with the word for conditional and the symbol for logical. But for QB64(PE) and whatever made like M$'s brand of BASIC, and other such dialects, we'll have to deal with the interpreter trying to figure out what is conditional and what is logical, without it needing to be in an "IF" statement. Attempts were made, I'm sure to try to force the conditional thing only in "IF" but many programmers resisted, so it is the way it is.

Anyway the solution should be use "&" for "AND" and "|" for "OR", in an example such as this one, and leave the words for conditional comparison. But it won't be done because "I can't run it in QBasic now and what am I going to do?"

Another thing is that arithmetic and logic don't interlock that well because the former tends to assume base-10 while the latter is base-2, and we're trying to write everything in base-10.

I ninja'ed @vince who provided a good solution. Good to know QBJS is flexible enough!

EDIT: Used incorrect terms, "logical" should be "bitwise", and "conditional" might be the same as "logical" but otherwise everything here is correct.
Reply


Messages In This Thread
QBJS v0.6.0 Release - by dbox - 11-07-2022, 01:43 PM
RE: QBJS v0.6.0 Release - by Pete - 11-07-2022, 04:32 PM
RE: QBJS v0.6.0 Release - by dbox - 11-07-2022, 05:08 PM
RE: QBJS v0.6.0 Release - by Pete - 11-07-2022, 06:26 PM
RE: QBJS v0.6.0 Release - by bplus - 11-07-2022, 07:17 PM
RE: QBJS v0.6.0 Release - by dbox - 11-08-2022, 07:20 PM
RE: QBJS v0.6.0 Release - by mnrvovrfc - 11-08-2022, 11:59 PM
RE: QBJS v0.6.0 Release - by mnrvovrfc - 11-07-2022, 07:53 PM
RE: QBJS v0.6.0 Release - by SpriggsySpriggs - 11-07-2022, 08:07 PM
RE: QBJS v0.6.0 Release - by dbox - 11-07-2022, 08:15 PM
RE: QBJS v0.6.0 Release - by mnrvovrfc - 11-07-2022, 08:17 PM
RE: QBJS v0.6.0 Release - by dbox - 11-07-2022, 08:40 PM
RE: QBJS v0.6.0 Release - by bplus - 11-08-2022, 07:31 PM
RE: QBJS v0.6.0 Release - by Pete - 11-08-2022, 07:34 PM
RE: QBJS v0.6.0 Release - by dbox - 11-08-2022, 07:51 PM
RE: QBJS v0.6.0 Release - by Coolman - 11-09-2022, 11:25 AM
RE: QBJS v0.6.0 Release - by dbox - 11-10-2022, 12:35 AM
RE: QBJS v0.6.0 Release - by Coolman - 11-10-2022, 11:33 AM
RE: QBJS v0.6.0 Release - by Pete - 11-10-2022, 02:31 AM
RE: QBJS v0.6.0 Release - by a740g - 11-10-2022, 01:46 PM
RE: QBJS v0.6.0 Release - by mnrvovrfc - 11-10-2022, 03:43 PM
RE: QBJS v0.6.0 Release - by dbox - 11-10-2022, 03:46 PM
RE: QBJS v0.6.0 Release - by a740g - 11-10-2022, 04:30 PM
RE: QBJS v0.6.0 Release - by dbox - 11-10-2022, 06:24 PM
RE: QBJS v0.6.0 Release - by a740g - 11-10-2022, 08:11 PM
RE: QBJS v0.6.0 Release - by CharlieJV - 11-10-2022, 08:40 PM
RE: QBJS v0.6.0 Release - by vince - 11-10-2022, 02:22 PM
RE: QBJS v0.6.0 Release - by Pete - 11-10-2022, 09:48 PM
RE: QBJS v0.6.0 Release - by Kernelpanic - 11-10-2022, 10:34 PM
RE: QBJS v0.6.0 Release - by vince - 11-10-2022, 11:48 PM
RE: QBJS v0.6.0 Release - by Kernelpanic - 11-11-2022, 12:30 AM
RE: QBJS v0.6.0 Release - by SMcNeill - 11-11-2022, 12:38 AM
RE: QBJS v0.6.0 Release - by Kernelpanic - 11-12-2022, 12:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  QBJS v0.10.0 - Release dbox 12 1,119 Yesterday, 12:38 PM
Last Post: bplus
  QBJS v0.9.0 - Release dbox 31 6,178 04-23-2025, 01:14 AM
Last Post: dbox
  QBJS v0.8.0 - Release dbox 11 2,386 02-13-2024, 10:11 PM
Last Post: grymmjack
  QBJS v0.8.2 - Release dbox 0 572 02-02-2024, 11:29 PM
Last Post: dbox
  BAM: Release notes in the works for upcoming release CharlieJV 6 1,443 10-12-2023, 01:42 AM
Last Post: CharlieJV

Forum Jump:


Users browsing this thread: 1 Guest(s)