Scripted pipelines in Jenkins run Groovy code step-by-step. This lets you use programming features like if-else conditions and loops. For example, you can check the branch name and decide what to do next. This flexibility means you can create dynamic build flows that change based on variables or environment. The execution table shows how the pipeline checks the branch and prints a message accordingly. Variables like env.BRANCH_NAME keep their values during execution. Beginners often wonder why scripted pipelines allow if-else; it's because they run real code. Also, if the branch is not 'main', the else block runs, showing flexibility. Adding loops would add more steps to the execution, showing each iteration. This makes scripted pipelines powerful for complex tasks.