From: Ralph on
Kevin Provance wrote:
> "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in
> message news:uHsagk3MKHA.4964(a)TK2MSFTNGP06.phx.gbl...
>> There is also the Choose function. This line...
>>
>> Command2.Caption = Switch(Running, "Pause", Not Running, "Resume")
>>
>> can also be written this way....
>>
>> Command2.Caption = Choose(2 + Running, "Pause", "Resume")
>>
>> Here is another new VB function for you to learn about... look up the
>> Partition function in the help files... and then try to figure out a
>> good use for it.<g>
>
> I knew about Choose, but Partition is another new one I missed.
> Besides the obvious example for SQL, I truly cannot think of a use
> for it. I'm going to have to give that one some thought. You'd
> think that after all these years I would have sat down with the
> Object Browser and just looked. ;-)

Two of my favorites, although definitely NOT new, but especially fun at code
reviews populateds with Bobs, et al, is
On ... Goto and On ... GoSub

Add a few Switches and Chooses and you can come close to an legitimate
Obfuscated Code entry.

-ralph


From: Kevin Provance on
Maybe it's my entry into the world of Basic at VB3 (does graphics work on an
Apple IIe count?) but not once have I ever used GoSub. Never. <g>

--
2025
If you do not believe in time travel,
your beliefs are about to be tempered.

http://www.facebook.com/group.php?gid=43606237254
"Ralph" <nt_consulting64(a)yahoo.com> wrote in message
news:%23fhHjLNNKHA.4004(a)TK2MSFTNGP04.phx.gbl...
| Kevin Provance wrote:
| > "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in
| > message news:uHsagk3MKHA.4964(a)TK2MSFTNGP06.phx.gbl...
| >> There is also the Choose function. This line...
| >>
| >> Command2.Caption = Switch(Running, "Pause", Not Running, "Resume")
| >>
| >> can also be written this way....
| >>
| >> Command2.Caption = Choose(2 + Running, "Pause", "Resume")
| >>
| >> Here is another new VB function for you to learn about... look up the
| >> Partition function in the help files... and then try to figure out a
| >> good use for it.<g>
| >
| > I knew about Choose, but Partition is another new one I missed.
| > Besides the obvious example for SQL, I truly cannot think of a use
| > for it. I'm going to have to give that one some thought. You'd
| > think that after all these years I would have sat down with the
| > Object Browser and just looked. ;-)
|
| Two of my favorites, although definitely NOT new, but especially fun at
code
| reviews populateds with Bobs, et al, is
| On ... Goto and On ... GoSub
|
| Add a few Switches and Chooses and you can come close to an legitimate
| Obfuscated Code entry.
|
| -ralph
|
|


From: Rick Rothstein on
> Two of my favorites, although definitely NOT new, but especially
> fun at code reviews populateds with Bobs, et al, is
> On ... Goto and On ... GoSub
>
> Add a few Switches and Chooses and you can come close to
> an legitimate Obfuscated Code entry.

I wouldn't know anything about that... I think I can say with all confidence
that I have never written any obfuscated code in my life.

<vbg>

--
Rick (MVP - Excel)

From: Ralph on

"Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in message
news:OG8UdfNNKHA.1372(a)TK2MSFTNGP02.phx.gbl...
> > Two of my favorites, although definitely NOT new, but especially
> > fun at code reviews populateds with Bobs, et al, is
> > On ... Goto and On ... GoSub
> >
> > Add a few Switches and Chooses and you can come close to
> > an legitimate Obfuscated Code entry.
>
> I wouldn't know anything about that... I think I can say with all
confidence
> that I have never written any obfuscated code in my life.
>
> <vbg>
>

Ahhhh, the ultimate

A On...Goto leading to a selection of one-liners, ending with a conditional
Choose().

-ralph


From: Rick Rothstein on
This one-liner function doesn't use On...GoTo, but I'm pretty sure it would
qualify as being somewhat obfuscated...

Function MakeOrdinal(Number As Long) As String
Oneliner = Number & IIf(Partition(Number Mod 100, 1, 13, 5) <> _
"11:13" And Partition(Number Mod 10, 1, 9, 3) = " 1: 3", _
Choose(Number Mod 10, "st", "nd", "rd"), "th")
End Function

It should be obvious, but in case it isn't, this function takes a number and
attaches the proper ordinal suffix (st, nd, rd, th) to the end of it. Now,
your challenge... explain the logic behind the function.<g>

--
Rick (MVP - Excel)


"Ralph" <nt_consulting64(a)yahoo.com> wrote in message
news:uAOcEBONKHA.220(a)TK2MSFTNGP02.phx.gbl...
>
> "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in message
> news:OG8UdfNNKHA.1372(a)TK2MSFTNGP02.phx.gbl...
>> > Two of my favorites, although definitely NOT new, but especially
>> > fun at code reviews populateds with Bobs, et al, is
>> > On ... Goto and On ... GoSub
>> >
>> > Add a few Switches and Chooses and you can come close to
>> > an legitimate Obfuscated Code entry.
>>
>> I wouldn't know anything about that... I think I can say with all
> confidence
>> that I have never written any obfuscated code in my life.
>>
>> <vbg>
>>
>
> Ahhhh, the ultimate
>
> A On...Goto leading to a selection of one-liners, ending with a
> conditional
> Choose().
>
> -ralph
>
>