Killing animals in Minecraft: Pocket Edition

To kill a animal find out what it likes to eat lets take a pig for example it likes carrots and wheat right so git some carrots or wheat and then constantly hit it with what it likes and then sooner or later it will die