printing a number into a box

is there a way to have an object with nothing in it and for something to make a number appear in that box. for example certain values are met in an if statement-which would then allow a blank box to make the number 5 to appear within it?