[Implemented] Modulo

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

i was not refering to the chained hasselhof but to the code that's brewing!
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

lol.
@}--`--,-- A rose by any other name ..
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Post by chris319 »

I also want ^ instead of Pow and Mod instead of %

And this is totally illogical, when you think on it. First swap a symbol for a keyword - but then swap a keyword for a symbol. We are so patterned!
I hate to bring up something as silly as a standard, but the ANSI/ISO standard for the BASIC programming language specifies ^ for exponentiation and MOD for modulo, so your wishes are not totally capricious. I second your vote for ^ and MOD.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

well purebasic is not the first basic dialect to use % for modulo, so that one is not an issue, but the ^ is indeed missing... and standards... it's pure, not standardbasic :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

It's much faster to compile with single-character tokens (like%).
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

In PB you have a logic:

- non ascii characters for binary operands: +, !, *, <<, % ...
- full letter keyword for logical operands: And, Or, XOr, possibly Not as well ;).

It's not planned to be changed at all.
akee
Enthusiast
Enthusiast
Posts: 496
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Post by akee »

Yes! I support the NOT operator...

PB feels naked without it... :p
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Post by chris319 »

In PB you have a logic:

- non ascii characters for binary operands: +, !, *, <<, % ...
- full letter keyword for logical operands: And, Or, XOr, possibly Not as well :wink:
Pow?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Pow() is a command, like Abs(). It's not a purebasic operand.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Post by chris319 »

Fred wrote:Pow() is a command, like Abs(). It's not a purebasic operand.
So if PB had a function Add(), it would be considered a command and not an operand.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

i'm just dreaming: the IN statement

Code: Select all

If "test" In "this is a test" : Endif

Dim myArray.b(10)

For i=0 to 10
    myArray(i)=Random(255)
Next

If 129 In myArray() : Endif
and so on...
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

chris319 wrote:So if PB had a function Add(), it would be considered a command and not an operand.
Exactly.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

is't that 'function' instead of command?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Flype wrote:i'm just dreaming: the IN statement

Code: Select all

If "test" In "this is a test" : Endif

Dim myArray.b(10)

For i=0 to 10
    myArray(i)=Random(255)
Next

If 129 In myArray() : Endif
and so on...
It will surely be used more than strictly neccessary, and that´s not good because it´s very slow.
MikeB
Enthusiast
Enthusiast
Posts: 183
Joined: Sun Apr 27, 2003 8:39 pm
Location: Cornwall UK

Post by MikeB »

I'm not quite sure what this is supposed to do
If "test" In "this is a test" : Endif

Dim myArray.b(10)

For i=0 to 10
myArray(i)=Random(255)
Next

If 129 In myArray() : Endif
Surely everything there will always take place as there is nothing happening between the If xxx and the EndIf in either case.
Post Reply