Page 1 of 1

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

Posted: Fri Mar 25, 2016 12:56 am
by gurj
hope: for If, add =(),>(),<(),>=(),<=(),<>()
Example:
If a=(b Or c) ;parity:
If a=b Or a=c

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

Posted: Fri Mar 25, 2016 1:19 am
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:

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

Posted: Fri Mar 25, 2016 1:44 am
by gurj
v5.40 no
but sorry, v5.41 ok

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

Posted: Fri Mar 25, 2016 9:05 am
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)

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

Posted: Fri Mar 25, 2016 9:45 am
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)

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

Posted: Fri Mar 25, 2016 10:24 am
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

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

Posted: Sat Apr 16, 2016 10:02 am
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

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

Posted: Sat Apr 16, 2016 5:54 pm
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

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

Posted: Mon Apr 18, 2016 10:24 pm
by DoubleDutch
ncp2k: good idea.