[Implemented] Modulo

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

MikeB wrote:I'm not quite sure what this is supposed to do
I'll hazard a guess that these are examples of an IN condition. So

Code: Select all

If "test" In "this is a test"
  ; do something as "test" sequence is found IN "this is a test"
Endif
If "best" In "this is a test"
  ; would not do anything, no "best" IN "this is a test"
Endif 

Dim myArray.b(10) 
For i=0 to 10 
    myArray(i)=i 
Next 
If 129 In myArray()
  ; Nothing done, array does not contain 129 in any element
Endif
If 2 In myArray()
  ; Does something as array does contain 2 in an element
Endif
Just guessing. The first is FindString in disguise?
@}--`--,-- A rose by any other name ..
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Findstring it is. And Findstring is even better because you can potentially speed it up by specifying a start point.
Last edited by netmaestro on Tue Feb 21, 2006 7:51 pm, edited 2 times in total.
BERESHEIT
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

Yes you guessed well. My examples were not very clear, sorry.
There's many case where the In statement should be usefull, just look at others languages like python, sql, and many others... I agree with the fact it could be slower, cleaner but slower. The 'In' keyword is commonly used with 'sets'. But remember what i said, i was just dreaming...
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
Post Reply