How to return a value from a void function and use it inside the void loop?

I didn't realize that tweet was global. You don't need any return statement then and the function can be a void function. Just alter tweet in print and use it from loop. It will keep whatever value you last gave it. Global variables are available for use anywhere in your code.