Ruby | Struct size() function Last Updated : 06 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The size() is an inbuilt method in Ruby that returns the total number of members present in struct. Syntax: struct_name.size() Parameters: The function does not accepts any parameter. Return Value: It returns the integer specifying the members of struct. Example 1: Ruby # Ruby program for size method in struct # Include struct Places = Struct.new(:name, :speciality) #initialize values detail = Places.new("Nagpur", "oranges") # size used puts detail.size Output: 2 Example 2: Ruby # Ruby program for size method in struct # Include struct animals = Struct.new(:name, :speciality , :found_in) # initialize values detail = animals.new("labrador", "bark" , "Newfoundland") # size used puts detail.size Output: 3 Comment More infoAdvertise with us Next Article Ruby | Struct size() function gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Struct-class Similar Reads Ruby | Struct == function The == is an inbuilt method in Ruby returns true if other has the same struct subclass and has equal member values. Syntax: struct1 == struct2 Parameters: The function accepts no parameter. Return Value: It returns boolean value true if both the given ranges are equal, else it returns false. Example 1 min read Ruby | Struct to_s() function The to_s() is an inbuilt method in Ruby that returns a string with the value of the particular struct. Syntax: struct_name.to_s() Parameters: The function does not accepts any parameter. Return Value: It returns the value of struct. Example 1: Ruby # Ruby program for to_s method in struct # Include 1 min read Ruby | Vector size() function The size() is an inbuilt method in Ruby returns the number of elements in the vector Syntax: vec1.size() Parameters: The function accepts no parameter Return Value: It returns the number of elements in the vector Example 1: Ruby # Ruby program for size() method in Vector # Include matrix require 1 min read Ruby | Struct eql?() function The eql?() is an inbuilt method in Ruby returns true if other has the same struct subclass and has equal member values. Syntax: struct1.eql?(struct2) Parameters: The function accepts no parameter. Return Value: It returns boolean value true if both the given ranges are equal, else it returns false. 1 min read Ruby | Symbol size function Symbol#size() : size() is a Symbol class method which returns the size/length of the symbol object. Syntax: Symbol.size() Parameter: Symbol values Return: the size/length of the symbol object. Example #1 : Ruby # Ruby code for Symbol.size() method # declaring Symbol a = :aBcDeF # declaring Symbol b 2 min read Ruby | Struct each() function The each() is an inbuilt method in Ruby returns every value of the struct in the existing order. In case no block is passed, it returns an enumerator. Syntax: struct_name.each{|x| block } Parameters: The function accepts a single parameter block which is the way it is iterated. Return Value: It retu 1 min read Ruby | Struct to_a() function The to_a() is an inbuilt method in Ruby that returns an array with the value of the particular struct. Syntax: struct_name.to_a[integer] Parameters: The function accepts an integer parameter which specifies the index of the struct value to be returned. Return Value: It returns the value of struct. 1 min read Ruby | SizedQueue size() function The size() is an inbuilt function in Ruby returns the current size of the SizedQueue or the number of objects present in it. Syntax: sq_name.size() Parameters: The function does not takes any parameter. Return Value: It returns the number of elements in the SizedQueue. Example 1: CPP #Ruby program f 1 min read Ruby | Struct length() function The length() is an inbuilt method in Ruby that returns the number of members in struct. Syntax: struct_name.length() Parameters: The function does not accepts any parameter. Return Value: It returns the number of members in the struct. Example 1: Ruby # Ruby program for length method in struct # Inc 1 min read Ruby | Set size() function The size() is an inbuilt method in Ruby returns the size of the Set. It returns the number of elements in the set. Syntax: s1_name.size() Parameters: The function does not accepts any parameter. Return Value: It returns the size of the set. Example 1: Ruby # Ruby program to illustrate # the size met 1 min read Like