hi guys , this code is rubbish but it looks like it is what i need to do , looking for better ways of writing it

cheers

Sheldon
Code:
    if counter= 1  then 
             if value0 <> newdata then 
               value1 = newdata
               counter = counter +1
             else 
                return
             endif
          endif
         
         if counter = 2 then 
           if value0 <> newdata then
               if Value1 <> newdata then
                value2 = newdata 
                counter = counter +1 
               else
                return
               endif
           endif    
         endif      
      
         if counter = 3 then 
           if value0 <> newdata then
              if Value1 <> newdata then
                if Value2 <> newdata then 
                 value3 = newdata 
                 counter = counter +1 
                else
                 return
                endif
             endif    
           endif      
        endif
      
      
       if counter = 4 then 
           if value0 <> newdata then
              if Value1 <> newdata then
                if Value2 <> newdata then 
                  if Value3 <> newdata then  
                     value4 = newdata 
                     counter = counter +1 
                  else
                    return
                  endif
                endif    
              endif      
           endif
        endif
          
      if counter = 5 then 
           if value0 <> newdata then
              if Value1 <> newdata then
                if Value2 <> newdata then 
                  if Value3 <> newdata then  
                    if Value4 <> newdata then
                       value5 = newdata 
                       counter = counter +1 
                    else
                      return
                    endif
                  endif    
                endif      
             endif
           endif
       endif     
      if counter = 6 then 
           if value0 <> newdata then
              if Value1 <> newdata then
                if Value2 <> newdata then 
                  if Value3 <> newdata then  
                    if Value4 <> newdata then
                       if Value5 <> newdata then 
                           value6 = newdata 
                           counter= counter +1  
                        else
                         return
                       endif
                     endif    
                    endif      
             endif
           endif
       endif