Question!!!

I was just wondering why can you get a positive pregnancy test when your period doesn't show up but not before that?