Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

ruby intersection of two arrays

x = [1, 1, 2, 4]
y = [1, 2, 2, 2]

# intersection
x & y            # => [1, 2]

# union
x | y            # => [1, 2, 4]

# difference
x - y            # => [4]
Comment

PREVIOUS NEXT
Code Example
Ruby :: rails on_delete cascade not working 
Ruby :: ruby capitalize first character of sentence 
Ruby :: post request rails link_to 
Ruby :: rails logger color 
Ruby :: List and delete migration from rails console 
Ruby :: http request ruby 
Ruby :: rails g model 
Ruby :: table name from rails console 
Ruby :: ruby ||= 
Ruby :: rails form_tag 
Ruby :: validates inclusion of rails 
Ruby :: if rails.env.development 
Ruby :: Ruby ruby-2.6.3 is present on the following stacks: heroku 16 
Ruby :: rails catch mail error 
Ruby :: ruby hash.each 
Ruby :: rails faker 
Ruby :: Ruby instance variabnl get 
Ruby :: ruby rails find data field type 
Ruby :: ruby case statement multiple conditions 
Ruby :: CSV total rows ruby 
Ruby :: ruby check if path is a directory 
Ruby :: rails duplicate record 
Ruby :: crashed" method=GET path="/" rails 
Ruby :: ruby puts inspect 
Ruby :: how to create tenant again using Appartment in rails 
Ruby :: ruby zip rows and columns 
Ruby :: ruby match all 
Ruby :: rails print number with space 
Ruby :: model with array rails 
R :: remove null element from list r 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =