showresults inside a funtion