Finite: with the binary operation of function composition. To prove that each element has finite order we use the following theorem:
Theorem: Let be a finite group, then for each we have that .
Proof: Suppose not. Then, must all be distinct, for to suppose that contradicting the assumption that . Thus, since is closed under multiplication it follows that and so . Contradiction.
Infinite: Let be an infinite set and be defined as above. Then, . To see this suppose not. Then, . Select elements and consider . Clearly and given by the obvious mapping is an embedding and . Thus, . But, by our assumption and so Lagrange's theorem implies that . Contradiction.
Does that answer your question? There are infinite groups whose elements all have finite order though. For example where each is a copy of