input: 
  from typing import List
  
  
  def save_or_exec_script(directives: List[str], data: List[str]) -> List[str]:
      """Given a list of script directives and a list of data, determine the output of the script based on the following rules:
      - If the directive is 'save', append the next data element to a result list.
      - If the directive is 'exec', execute (i.e., return) the result list immediately.
      - If the directive is invalid, ignore it and move to the next one.
      Each directive corresponds to the data at the same index.
      
      >>> save_or_exec_script(['save', 'exec', 'save', 'exec'], ['apple', 'banana', 'cherry', 'date'])
      ['apple']
      >>> save_or_exec_script(['save', 'save', 'save', 'exec'], ['apple', 'banana', 'cherry', 'date'])
      ['apple', 'banana', 'cherry']
      >>> save_or_exec_script(['exec', 'save', 'exec', 'save'], ['apple', 'banana', 'cherry', 'date'])
      []
      """
      result = []
      for i, directive in enumerate(directives):
          if directive == 'save':
              result.append(data[i])
          elif directive == 'exec':
              return result
      return result
  
output:     result = []
      for i, directive in enumerate(directives):
          if directive == 'save':
              result.append(data[i])
          elif directive == 'exec':
              return result
      return result