Infinite loop in python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • learnerofpython
    New Member
    • Nov 2006
    • 14

    Infinite loop in python

    hi!
    What wud be the python equivalent of the C statement
    while(some condition); (i.e no statement gets executed)


    any ideas.please let me know
  • fuffens
    New Member
    • Oct 2006
    • 38

    #2
    Well...

    Code:
    while(True):
        pass
    for an infinite loop that does nothing and

    Code:
    while(some condition):
        pass
    for some other condition

    BR
    /Fredrik

    Comment

    • David Hall

      #3
      an infinite counter would be...

      Code:
      def infinite counter(x)
          while x>0:
              x=x+1
              print(x)
      print(infinatecounter(1))

      Comment

      Working...