Is it recommended to create multiple if statements and nest loops inside of them or create one loop and nest multiple if statements inside of that? I am wondering in terms of memory, time, and other factors I may have overlooked.
Here is some pseudocode:
if a: for i in range(500): do x if b: for i in range(500): do y
versus
for i in range(500): if y: do x if z: do p
In other words, when is the best time to do the if-statement. Inside a few nested loops or before any of the loops?
Aucun commentaire:
Enregistrer un commentaire