Weird plot behavior within function

Hi,
Trying to display plots within a function, no plot window was showing. Digging to the root here is the issue: tp() is displaying plot and not tp1()? Cannot get the rational on why a function returning any value including nothing is blocking ‘GKS Qterm’ to show? From a plot usage perspective It doesn’t make sense to me …
Thanks

 using Plots

function tp()
	a = rand(Float32,9)
	b = rand(Float32,9)
	plot(a)
	plot!(b)
end

function tp1()
	a = rand(Float32,9)
	b = rand(Float32,9)
	plot(a)
	plot!(b)
	
	return a
end

You have to call display. In the first one, the repl is visualizing the result because it is a plot. In the second one, it is not the case. However, using display you guarantee to show it.

Works like a charm :slight_smile: many thanks