Here’s an Example:
Let’s say you buy a share for $10 in a video game company. The company makes money and you find a buyer who will pay you $15 because they think the company will continue to make money. You sell and have made a profit of $5. However, if the company loses money, then you might only be able to sell your share for $8. This means you would lose $2.