Logo

Programming-Idioms

History of Idiom 5 > diff from v8 to v9

Edit summary for version 9 by :

Version 8

2015-08-21, 11:29:09

Version 9

2015-08-21, 23:01:23

Idiom #5 Create a 2D Point data structure

Declare a container type for two floating-point numbers x and y

Idiom #5 Create a 2D Point data structure

Declare a container type for two floating-point numbers x and y

Code
Point = Struct.new(:x, :y)
Code
Point = Struct.new(:x, :y)
Comments bubble
init like this : Point.new(1.0,1.0)
Comments bubble
init like this : Point.new(1.0,1.0)
Doc URL
http://www.ruby-doc.org/core-2.1.0/Struct.html
Origin
http://www.ruby-doc.org/core-2.1.0/Struct.html