I am just learning python. I am switching from visual basic so this is a bit new to me. I am trying to write a loop for a super small script. It is below I am trying to understand the def f() how to loop that short code over and over until it hits an obstacle. I understand this is UBER NOOB stuff but I have been looking on google for like an hour and on here for a while but still dont understand the def f(). I saw tons of examples of it used for other purposes but didn't get how to use it for a small loop. Please help and possibly explain the syntax a bit if you can because I keep getting syntax errors when im using it. Thanks


while look () == Void:
forward ()
left ()

Please post your entire program, using code tags, and tell us what is happening that you don't expect.

while look () == Void:
will loop indefinitely when they are not equal because the contents of the variable Void and the function look() don't change. You might want to send some variable to look() and return something other than the value of the Void when you want to exit. Functions explained http://greenteapress.com/thinkpython/html/book004.html#toc28

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.