hope: for If, add =(),>(),<(),>=(),<=(),<>()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by gurj »

hope: for If, add =(),>(),<(),>=(),<=(),<>()
Example:
If a=(b Or c) ;parity:
If a=b Or a=c
my pb for chinese:
http://ataorj.ys168.com
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by Thunder93 »

If its even an option. I've seen this in scripting languages way back when I started on Internet in the late 1990's.

When I started working with PB, really missed such conveniences. I actually still do miss..

+1 for me :wink:



...edit: I actually want to give it +1000 to actually get the ball rolling. :twisted:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by gurj »

v5.40 no
but sorry, v5.41 ok
my pb for chinese:
http://ataorj.ys168.com
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by HanPBF »

That turns into unreadable code...

Code: Select all

procedure orEqs(a.s, b.s, c.s)
  if a=b or a=c
   procedureReturn True
  endif
  procedureReturn False
endProcedure ; orEqs(a.s, b.s, c.s)
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by Danilo »

Looks like a nice shortcut:

Code: Select all

; PB today
If theVariable=123 Or theVariable=456 Or theVariable=789
    ; Do something
EndIf

; Operator =()
If theVariable=(123 Or 456 Or 789)
    ; Do something
EndIf
Not sure it makes sense with <() and >() etc.?

Code: Select all

If theVariable>(123 Or 456 Or 789)
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by gurj »

pb not enlist them all now.

Code: Select all

;a=8:b=8
If a=(b Or d):Debug 8:EndIf;show 8
but

Code: Select all

a=8:b=8
If a=(b Or d):Debug 8:EndIf;show no
my pb for chinese:
http://ataorj.ys168.com
User avatar
langinagel
Enthusiast
Enthusiast
Posts: 131
Joined: Fri Jan 28, 2005 11:53 pm
Location: Germany
Contact:

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by langinagel »

Hi,

I do have objections against these shortcuts.
All kind of Software Quality literature plead for strict style guides to restrict these shortcuts that decrease the readability of the code.
So if we do not have these shortcuts, the readability and the better understanding is given, thus code reviews have less objections.

Maybe this view will not be shared by the majority....

Greetings
LN
https://www.doerpsoft.org

Boost. Work. Efficiency.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by nco2k »

i requested this years ago, without the ( ) though:

Code: Select all

If Foo = 1, 2, 34 To 56, 78 Or Bar = 9
its basically like a more flexible Select:Case.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: hope: for If, add =(),>(),<(),>=(),<=(),<>()

Post by DoubleDutch »

ncp2k: good idea.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply