#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    17
    Rep Power
    0

    How to get specific value of CFLOOP?


    For example, i have the code below.

    <cfloop index = i from = 1 to = 5>

    I want to set the value of 1 to First_Variable or I want to set the 5th value to Fifth_Value. How will I do this in CF?

    Thanks.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,269
    Rep Power
    968
    If I follow what you're asking, something like:

    <cfloop index="i" from=1 to=5>
    <cfif i eq 1>
    <cfset first_variable = i />
    </cfif>
    </cfloop>

    That said, given your example I can't really imagine why you'd want to do it this way, but I assume what you're actually trying to do is more complex than this.

IMN logo majestic logo threadwatch logo seochat tools logo