input: Write a function to generate a list of numbers from 0 to a specified upper limit using a while loop, and print the list at the end. The function should return the generated list. If the upper limit is negative, the function should return an empty list.
  assert generate_list_to_limit(10)==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  assert generate_list_to_limit(5)==[0, 1, 2, 3, 4]
  assert generate_list_to_limit(0)==[0]
  assert generate_list_to_limit(-1)==[]
  assert generate_list_to_limit(-5)==[]
output: def generate_list_to_limit(upper_limit):
      if upper_limit < 0:
          return []
      result = []
      i = 0
      while i < upper_limit:
          result.append(i)
          i += 1
      return result