𝗟𝗼𝗼𝗽𝘀 𝗮𝗻𝗱 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀
Write better code with loops and functions.
For Loops Use for loops to repeat a task a set number of times. It uses three parts:
- Start value
- Stop condition
- Change value
Do While Loops These loops run the code first. They check the condition last. The code always runs one time.
Functions Functions are reusable code blocks. They keep your work organized.
- Parameters: Placeholders for your data.
- Arguments: Real values you pass into the function.
Default Parameters You set a backup value. The function uses this backup if you provide no input.
Return Statements A return statement sends a result back to you. It stops the function.
Source: https://dev.to/kamalesh_ar_6252544786997/loops-and-function-10dd