Sha256: ffa2fee013d8a127353edd09d6961ee76339ed1a8d3bb112326e01700de90825

Contents?: true

Size: 670 Bytes

Versions: 10

Compression:

Stored size: 670 Bytes

Contents

# Integers and floats are two different kinds of numerical data. 
# An integer (more commonly called an int) is a number without 
# a decimal point. A float is a floating-point number, which means 
# it is a number that has a decimal place. Floats are used when
# more precision is needed. 


def setup
  size 200, 200  
  stroke 255
  frame_rate 30
  
  @a = 0		# Create an instance variable "a" of class Integer
  @b = 0.0	# Create an instance variable "b" of class Float (because of "0.0")
end

def draw
  background 51
  
  @a += 1
  @b += 0.2
  
  line @a, 0,        @a, height/2
  line @b, height/2, @b, height
  
  @a = 0 if @a > width
  @b = 0 if @b > width
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.6.2 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.6.1 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.6.0 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.5.1 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.5.0 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.4.4 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.4.3 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.4.2 samples/processing_app/basics/data/integers_floats.rb
ruby-processing-2.4.1 samples/processing_app/basics/data/integers_floats.rb