Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Ternary operators: a hinderance, not a help

by Tanalis (Curate)
on Aug 09, 2005 at 15:47 UTC ( #482266=note: print w/replies, xml ) Need Help??

in reply to Re: Ternary operators: a hinderance, not a help
in thread Ternary operators: a hinderance, not a help

I .. wouldn't have written the if that way, either, though .. :)

I've changed the example in the OP to make it clearer - thanks :)

Replies are listed 'Best First'.
Re^3: Ternary operators: a hinderance, not a help
by Joost (Canon) on Aug 09, 2005 at 15:53 UTC

      As an aside: in Ruby where if is an expression not a statement you can write something very close without all the extraneous squiggles.

      number = if logical_test value else 0 end

      Not to mention case is also an expression and can be used similarly.

      zerg = case foo when "bar" when "baz" more_creep() else raise "Too few Starcraft references" end

      We're looking for people in ATL

        That isn't exactly new. In ALGOL 68 (and perhaps earlier versions as well), you could do:
        IF a THEN b ELSE c FI := IF d THEN e ELSE f FI
        more or less equivalent to Perls:
        ($a ? $b : $c) = ($d ? $e : $f);
        Yes. Isn't Ruby nice ;-) Most of your example niceness is due to syntax, though... I've been using ruby for a couple of months now, and at first I didn't like the begin ... end type statements, but you get used to them pretty quicky, and now I actually prefer them over { ... } in ruby.

        Seriously, I'm using ruby for a project now, and it *is* pretty damn good. Some of the design decisions in perl 6 are good too, but overall, I actually like the current ruby design better than perl 6. I mean, hyper operators are cool and all, but where is my easy operator overloading?

        please someone tell me how to do overloading in perl 6

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://482266]
Discipulus IE just maps to id est in my mind .. ;=)
[Corion]: marto: I believe nowadays, at least window.opener should not be set anymore (except maybe within the same domain)
[Corion]: But I wouldn't really know as I don't use iexplore much (except at $work) and mostly surf with JS disabled (except at $work :) )
[marto]: yeah, this is at work, where some intranet app launches links via When users close the intranet page so that only the new JS opened windows exist, clicking URLs in an email (or whatever) don't open

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-03-21 11:47 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (267 votes). Check out past polls.