You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2002/07/19 06:13:25 UTC

DO NOT REPLY [Bug 10974] New: - Break / return statement

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10974>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10974

Break / return statement

           Summary: Break / return statement
           Product: Velocity
           Version: 1.3-rc1
          Platform: Sun
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Testing
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: paroolsheth@yahoo.com


Please answer this as soon as possible: how do i break from a loop / return a 
value from a macro based on some condition

Please have a look at this code

#macro ( countTabbedSection $position )
position = $position
#set ($loopend = $alSections.size() - 1)
#foreach ($count in [$position..$loopend])
 #set( $sectiondataobject = $alSections.get($count) )
 #if ($sectiondataobject.getIsTabbed()==1)
 sectiondataobject.getIsTabbed() = $sectiondataobject.getIsTabbed()
 #else
  ## i want to break this loop here
 #end
#end
#end ## end of macro


#set( $count = 0 )
#foreach ($sectiondataobject in $alSections)
 #countTabbedSection( $count )
 #set( $count=$count+1 )
#end

 

Thanks

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>