Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

ruby array of strings

# Array of symbols
%i[address city state post_code country]
=> [:address, :city, :state, :post_code, :country]

# Array of strings
 %w[address city state postal country]
=> ["address", "city", "state", "postal", "country"]

# Array of interpolated symbols
postal_label = 'zip'
%I[address city state #{postal_label} country]
=> [:address, :city, :state, :zip, :country]

# Array of interpolated strings
%W[address city state #{postal_label} country]
=> ["address", "city", "state", "zip", "country"]
# Instead of %i[] you may use %i{} or %i() or %i!!
Comment

PREVIOUS NEXT
Code Example
Ruby :: infinite loop in ruby 
Ruby :: ruby delete method 
Ruby :: resources rails 
Ruby :: rails log levels 
Ruby :: ruby for programmers 
Ruby :: ruby add coma to array of string 
Ruby :: how to add variable inside string ruby 
Ruby :: setp in ruby loop 
Ruby :: * 16**index position in ruby 
Ruby :: intermediate rails project 
Ruby :: ruby assign rest of array 
Ruby :: <= operator in rails 
Ruby :: stringio original_filename 
Ruby :: ruby negative indices fizz buzz 
Ruby :: irb loaderror 
Ruby :: parameterized scope rails code 
Ruby :: comment 
Ruby :: rails time format iso8601 
Ruby :: ruby-on-rails 
R :: remove na from vector r 
R :: how to re-arrange weekdays in r 
R :: merge multiple data frames in r 
R :: rename variables in r 
R :: how to do logistic regression in r 
R :: rep in r 
R :: r suppress package loading messages 
R :: how many pairwise combinations 
R :: How to calculate standardized residuals in R 
R :: count r 
R :: if else functionr 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =