Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Double salvo function

Double salvo function

Scheduled Pinned Locked Moved The Weird and The Wonderful
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    red_moon
    wrote on last edited by
    #1

    I just read a function code like this : :laugh:

    function MightyFunction(paramA, paramB, paramC)
    ! Lots of code here.
    ! But this is the magic.
    Return retA
    Return retB

    The code is written in Centura 1.5, and the compiler compiled it successfully.

    It's easy to laugh, but, it's so hard to smile ...

    B B E 3 Replies Last reply
    0
    • R red_moon

      I just read a function code like this : :laugh:

      function MightyFunction(paramA, paramB, paramC)
      ! Lots of code here.
      ! But this is the magic.
      Return retA
      Return retB

      The code is written in Centura 1.5, and the compiler compiled it successfully.

      It's easy to laugh, but, it's so hard to smile ...

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      That would compile in Visual Studio also. Just a warning about "unreachable code detected".

      R 1 Reply Last reply
      0
      • R red_moon

        I just read a function code like this : :laugh:

        function MightyFunction(paramA, paramB, paramC)
        ! Lots of code here.
        ! But this is the magic.
        Return retA
        Return retB

        The code is written in Centura 1.5, and the compiler compiled it successfully.

        It's easy to laugh, but, it's so hard to smile ...

        B Offline
        B Offline
        BobJanova
        wrote on last edited by
        #3

        I sometimes use kick-out returns to temporarily 'comment out' code I suspect of breaking things. You can still do it in C# (might be an error in Java, I forget), and obviously in things like JavaScript or PHP. Leaving one in is pretty bad though.

        1 Reply Last reply
        0
        • B Bernhard Hiller

          That would compile in Visual Studio also. Just a warning about "unreachable code detected".

          R Offline
          R Offline
          red_moon
          wrote on last edited by
          #4

          I just can't imagine, what the intention of "double return" :-D

          It's easy to laugh, but, it's so hard to smile ...

          1 Reply Last reply
          0
          • R red_moon

            I just read a function code like this : :laugh:

            function MightyFunction(paramA, paramB, paramC)
            ! Lots of code here.
            ! But this is the magic.
            Return retA
            Return retB

            The code is written in Centura 1.5, and the compiler compiled it successfully.

            It's easy to laugh, but, it's so hard to smile ...

            E Offline
            E Offline
            ekolis
            wrote on last edited by
            #5

            Hmm, for some reason that reminds me of the custom scripting language used in the game "Space Empires V"... one of its unique quirks was that a "return" statement did not actually terminate function execution! So the function you describe would in SE5 script wind up returning retB, because it's the last return statement to execute...

            J 1 Reply Last reply
            0
            • E ekolis

              Hmm, for some reason that reminds me of the custom scripting language used in the game "Space Empires V"... one of its unique quirks was that a "return" statement did not actually terminate function execution! So the function you describe would in SE5 script wind up returning retB, because it's the last return statement to execute...

              J Offline
              J Offline
              Julien Villers
              wrote on last edited by
              #6

              Pascal also has a non terminating return semantics, but it's much clearer than that (as could be expected from Pascal ;))!

              'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

              E 1 Reply Last reply
              0
              • J Julien Villers

                Pascal also has a non terminating return semantics, but it's much clearer than that (as could be expected from Pascal ;))!

                'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood 'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                E Offline
                E Offline
                ekolis
                wrote on last edited by
                #7

                Hmm, that would actually explain the SE5 language, as it does look quite a bit like Pascal... the guy who wrote the game was apparently primarily a Delphi programmer!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups