why do I get syntax error on if <code>: break

bartc bc at freeuk.com
Fri May 25 06:17:33 EDT 2018


On 25/05/2018 11:08, asa32sd23 at gmail.com wrote:
> On Thursday, May 24, 2018 at 10:12:46 PM UTC-4, asa3... at gmail.com wrote:
>> here is the code, i keep getting an error, "break outside loop". if it is false just exit function
>>
>>
>> def d(idx):
>>      if type(idx) != int:
>>          break
>>
>> d('k')
> 
> thanks... I believe the compiler. So how do I exit or return nothing?
> 

Use 'return' instead of 'break'.





More information about the Python-list mailing list