How to Work with Loops
ฝัง
- เผยแพร่เมื่อ 5 ส.ค. 2024
- This video provides a comprehensive guide on how to effectively utilize the 'For Loop', 'For Each Loop', and 'While Loop' within Xano. Looping is a basic concept that allows for iteration over repetitive tasks, modification of items in a list, and much more. Learn practical tips and examples to enhance your back-end development skills.
00:00 - Intro
00:30 - For Loop
01:20 - For Each Loop
03:04 - The best way to iterate through a long list of items
04:32 - While Loop
Xano - The Fastest No Code Backend Dev Platform
go.xano.co/3V5aGii
Twitter
/ nocodebackend
Subscribe to Xano's Channel for Weekly New Content
/ nocodebackend - วิทยาศาสตร์และเทคโนโลยี
Hi, so in the while loop, you created a variable number outside the loop. Does this mean that when you update the variable inside the loop, automatically the loop considers that internal variable value? Just trying to understand the "intrinsic" of the variable if similar to a i = i + 1. Thank you.
Hi! Yes, that’s correct. When you create a variable outside the while loop and update it inside the loop, the loop will use the updated value of that variable in each iteration to determine whether to continue looping or not.
This means that any changes made to the variable inside the loop will affect the loop’s behavior on subsequent iterations. Just like in your example where you mentioned i = i + 1, if i is used in the loop’s condition, each increment of i inside the loop brings it closer to meeting the condition that ends the loop. So, in the case of a while loop, the variable’s current (updated) value is always considered in the loop’s condition check before each iteration. This allows the loop to function dynamically based on the operations performed inside it.