Writing comedy is easier than you'd think, just as long as you're prepared to do a huge amount of unpaid, unappreciated work and put up with continual rejection, including being yelled at by 'industry people' who think they know better, even though they are short and were clearly teased at school.
Comedy in written form is as old as written language. Indeed, some people say that writing itself was first developed in order to note down particularly funny dinner party anecdotes.