Get individual item count get_item_count calls to an API and gets a count.  There are several pages to get this count from until there are no more results.

How do I improve this code to remove all of the extra variables and make it easier to read?

final_count = 0
page = 1
final_count = individual_count = get_item_count(config, page)
while individual_count &gt; 20
  page = page + 1
  individual_count = get_item_count(config,page)
  final_count = individual_count + final_count
end
Use a do-while loop, so the loop body gets always executed at least once:

final_count = 0
page = 1
begin
  individual_count = get_item_count(config, page)
  final_count += individual_count
  page += 1
end while individual_count &gt; 20