POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Attached to Project: POV-Ray
Opened by Mike H - 2010-06-09
Last edited by Christoph Lipka - 2010-08-29

FS#122 - #ELSEIF statement

Request an #ELSEIF statement in POV SDL.

Closed by  Christoph Lipka
Sunday, 29 August 2010, 20:13 GMT
Reason for closing:  Fixed
Admin
Christoph Lipka commented on Saturday, 19 June 2010, 00:29 GMT

implemented with change #5021

Jim Holsenback commented on Saturday, 19 June 2010, 01:28 GMT

Isn't the current #switch implementation an elseif variant?

Admin
Christoph Lipka commented on Saturday, 19 June 2010, 02:20 GMT

The #switch directive is only designed for situations where all conditions are identity or range comparisons with one common expression; #elseif on the other hand is designed to help with the generic case where the #else branch is comprised of just another #if directive, as in:

#if ( Foo != Bar )
  // A
#else
  #if ( Fnord = 42 )
    // B
  #else
    #if ( IsFoobar )
      // C
    #else
      // D
    #end
  #end
#end

With #elseif, this can be written much prettier as:

#if ( Foo != Bar )
  // A
#elseif ( Fnord = 42 )
  // B
#elseif ( IsFoobar )
  // C
#else
  // D
#end

There is also a way to do this with #switch, but I wouldn't consider it very intuitive, and it also comes with some pitfalls.

Mike H commented on Sunday, 20 June 2010, 00:11 GMT

#switch also only compares against a single value. Further, in some languages you are limited to only string and number values (not sure how this applies to POV-Ray since there are no objects in the programming sense...).

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing