Sha256: d449311c7d10fc13e399488f4f06c540eaae80f51ca76e199a2a85ae31b6180b

Contents?: true

Size: 541 Bytes

Versions: 4

Compression:

Stored size: 541 Bytes

Contents

require 'ruby-processing'

class InfiniteLoop < Processing::App

  def setup
  
  end
  
  def draw
    
    x = 0
    while x < 10
      puts x
      # Decrementing x results in an infinite loop here because the value of x will never be 10 or greater. 
      # Be careful!
      x = x - 1
    end

    # This example does not include the break function.
    # To stop the runaway loop, close the window or use control-c in the terminal.
  end
  
end

InfiniteLoop.new :title => "Infinite Loop (Don't do this)", :width => 200, :height => 200

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-processing-1.0.1 samples/learning_processing/chapter_06/04_infinite_loop.rb
ruby-processing-1.0.2 samples/learning_processing/chapter_06/04_infinite_loop.rb
ruby-processing-1.0.4 samples/learning_processing/chapter_06/04_infinite_loop.rb
ruby-processing-1.0.3 samples/learning_processing/chapter_06/04_infinite_loop.rb