# do_while_sim.py (Python 2.7)
counter = 0
maks = 3
while True:
# aksi yang harus dijalankan minimal 1x
print "Do-while simulasi, iterasi:", counter
counter += 1
# kondisi berhenti (cek di akhir)
if not (counter < maks):
break
print "Keluar dari do-while simulasi."
IyBkb193aGlsZV9zaW0ucHkgIChQeXRob24gMi43KQpjb3VudGVyID0gMAptYWtzID0gMwoKd2hpbGUgVHJ1ZToKICAgICMgYWtzaSB5YW5nIGhhcnVzIGRpamFsYW5rYW4gbWluaW1hbCAxeAogICAgcHJpbnQgIkRvLXdoaWxlIHNpbXVsYXNpLCBpdGVyYXNpOiIsIGNvdW50ZXIKICAgIGNvdW50ZXIgKz0gMQoKICAgICMga29uZGlzaSBiZXJoZW50aSAoY2VrIGRpIGFraGlyKQogICAgaWYgbm90IChjb3VudGVyIDwgbWFrcyk6CiAgICAgICAgYnJlYWsKCnByaW50ICJLZWx1YXIgZGFyaSBkby13aGlsZSBzaW11bGFzaS4i