Columns (f) and (g) on Form 8949 are used to report the gain or loss codes. These codes help to identify the type of asset sold or exchanged and the tax treatment of the gain or loss. For example, code A indicates a sale or exchange of a capital asset not otherwise specified, while code H indicates a sale or exchange of collectibles. It is important to use the correct codes to ensure accurate reporting of your capital gains and losses.