I cut this section out of another wiki page (where it should never have been - sorry about that) & put it into its own wiki page. I modified the content a little too:
Add a Swapfile
Sometimes for whatever of the many reasons we would prefer to be able to quickly & easily add/remove a swap space, without having to involve swap partitions in the exercise.
Have a read of the Wiki page as there is a whole lot more to this subject re. possibilities than the above would indicate...