How did ancient egyptians control the flooding waters of the nile?

Ancient Egyptians weren't able to control the flooding water of the Nile river. However, they used the Nile for fertile soil because it was very predictable.