Module 6

Why functions exist

Reusable blocks of code.

Do it once, use it many times

Imagine you need to compute GC content for many sequences. Instead of rewriting the formula each time, you can define a function once and call it whenever you need it.

Why it matters

Functions let you give a name to a block of code. You write it once, then use it many times. This makes code shorter, clearer, and easier to fix.

Why are functions useful?