Apple CEO Tim Cook delivered the commencement address at the Massachusetts Institute of Technology Friday, and he couldn't help taking a swipe at a rival.

In a section of his speech describing his search for answers and tough decisions in college and beyond, he admitted turning to a Microsoft computer.

"I went to grad school at Duke, looking for the answer," Cook said. "I tried meditation. I sought guidance and religion. I read great philosophers and authors. In a moment of youthful indiscretion, I might even have experimented with a Windows PC. And obviously that didn't work."

The joke, starting around 10:22 in the video above, got a hearty laugh from the crowd.

Cook went on to describe his early days at Apple with founder Steve Jobs. "I had never met a leader with such passion, or encountered a company with such a clear and compelling purpose to serve humanity."

The speech comes just a few days after Cook's appearance on stage at Apple's Worldwide Development Conference, where the company announced numerous new products including updated Apple laptops and desktops, a new iPad and the new HomePod speaker.