Doug McMillon has announced his departure as CEO of Walmart, citing the rise of artificial intelligence as a key factor in his decision.