# From Apple to Raspberry Pi: While Loops In Xcode, both in Objective-C and C, we have the `while `loop.

```int number = 5;
while (number > 0){
NSLog(@"The number is %i",number--);
}
```

The python equivalent is also `while` Since we already understand the block, know sometimes as a suite in Python, `while `loops in  Python are very simple to use.

```number = 5
while number > 0:
number = number -1
print ('The number is ', number)
```

We can use `break` in a loop to break execution. This is a valid loop if we need to test at the end of the loop

```number = 5
while True:
number = number -1
print ('The number is ', number)
if number < 0:
break
```

This site uses Akismet to reduce spam. Learn how your comment data is processed.
{"ft_lang_label":"__label__en","ft_lang_prob":0.86312205,"math_prob":0.9933815,"size":580,"snap":"2022-27-2022-33","text_gpt3_token_len":154,"char_repetition_ratio":0.2048611,"word_repetition_ratio":0.10714286,"special_character_ratio":0.2913793,"punctuation_ratio":0.12,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99255055,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-07-06T13:15:40Z\",\"WARC-Record-ID\":\"<urn:uuid:21475479-108a-4118-9cb1-b31fa54115c0>\",\"Content-Length\":\"90558\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:983efa91-fd7a-4989-a075-65cc3148d6e5>\",\"WARC-Concurrent-To\":\"<urn:uuid:b120c6ab-2018-40cc-840c-7296c5945fd1>\",\"WARC-IP-Address\":\"192.0.78.25\",\"WARC-Target-URI\":\"https://makeapppie.com/2014/03/26/from-apple-to-raspberry-pi-while-loops/\",\"WARC-Payload-Digest\":\"sha1:J2JBXLRDZYTKYF5WXDHLFG32ZMJBI23X\",\"WARC-Block-Digest\":\"sha1:WVVDX36HOFTPFER3XWVCLO2LOHJR3FEE\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656104672585.89_warc_CC-MAIN-20220706121103-20220706151103-00023.warc.gz\"}"}