Giter Club home page Giter Club logo

Comments (2)

richpl avatar richpl commented on June 3, 2024

I'm torn about this one. As you say, there are no booleans so it feels a bit awkward, although I know Perl makes a similar compromise.

from pybasic.

JiFish avatar JiFish commented on June 3, 2024

Yeah, I can understand your reluctance on this one. Ultimately, it is down to you.

But if it strengthens the case, this is how most versions of BASIC have dealt with it since 1980. Sort of...

MS BASIC variants like Commodore BASIC, locomotive etc. returned -1 and 0 from relational operators. Logical operators converted to an integer and did a bitwise operation. I did suggest something a bit more like Perl for the sake of keeping it simple. But it adds up to the same functionality.

As an alternative, you can sort of achieve this already with some tricks.

10 REM A IS TRUE (1)
20 A = 9 < 10
30 REM B IS FALSE (0)
40 B = 9 = 10
50 REM LOGICAL OR
60 PRINT IF$ ( ( A + B ) > 0 , "TRUE" , "FALSE" )
70 REM LOGICAL AND
80 PRINT IF$ ( ( A + B ) = 2 , "TRUE" , "FALSE" )
90 REM LOGICAL XOR
100 PRINT IF$ ( ( A - B ) <> 0 , "TRUE" , "FALSE" )

from pybasic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.