# Need help writing while loop

**URL:** <https://forum.inductiveautomation.com/t/need-help-writing-while-loop/19251>\
**Category:** Ignition\
**Created:** [August 14, 2018, 5:50pm UTC](https://forum.inductiveautomation.com/t/need-help-writing-while-loop/19251 "2018-08-14T17:50:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nruimveld](https://avatars.discourse-cdn.com/v4/letter/n/8797f3/32.png) [@nruimveld](https://forum.inductiveautomation.com/u/nruimveld)\
**Post date:** [August 14, 2018, 5:50pm UTC](https://forum.inductiveautomation.com/t/need-help-writing-while-loop/19251/1 "2018-08-14T17:50:36Z")

</div>

Hello all!

I’m trying to loop through this to when the Command\_commands shows ‘G4N3F’, I need to write to BP2\_Has\_Cook.

if Has\_Command \< 1:  
system.tag.write(“AGCs/AGC2/To\_Cart/Command\_commands”, ‘DG4N3F’)  
system.tag.write(“AGCs/AGC2/To\_Cart/Command\_distances”, ‘113,14,127,157’)  
system.tag.write(“AGCs/AGC2/To\_Cart/Command\_rfids”, rfid\_35+","+rfid\_36+","+rfid\_30+","+rfid\_8)  
system.tag.write(“AGCs/AGC2/Status/JustLoaded”, 0)  
system.tag.write(“Backpacks/BP2\_Has\_Cook”, 1)  
else:  
pass

Thank you!
