HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/ri/3.0.0/system/Array/sum-i.ri
U:RDoc::AnyMethod[iI"sum:ETI"Array#sum;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I">When no block is given, returns the object equivalent to:;To:RDoc::Markup::Verbatim;	[I"sum = init
;TI",array.each {|element| sum += element }
;TI"	sum
;T:@format0o;
;	[I"RFor example, <tt>[e1, e2, e3].sum</tt> returns </tt>init + e1 + e2 + e3</tt>.;To:RDoc::Markup::BlankLineo;
;	[I"Examples:;To;;	[I"a = [0, 1, 2, 3]
;TI"a.sum # => 6
;TI"a.sum(100) # => 106
;T;0o;
;	[I"IThe elements need not be numeric, but must be <tt>+</tt>-compatible ;TI"%with each other and with +init+:;To;;	[I"a = ['abc', 'def', 'ghi']
;TI"&a.sum('jkl') # => "jklabcdefghi"
;T;0o;
;	[I";When a block is given, it is called with each element ;TI"Xand the block's return value (instead of the element itself) is used as the addend:;To;;	[I"a = ['zero', 1, :two]
;TI"Gs = a.sum('Coerced and concatenated: ') {|element| element.to_s }
;TI"1s # => "Coerced and concatenated: zero1two"
;T;0o;
;	[I"Notes:;To:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;	[o;
;	[I"?Array#join and Array#flatten may be faster than Array#sum ;TI"5for an \Array of Strings or an \Array of Arrays.;To;;0;	[o;
;	[I"[Array#sum method may not respect method redefinition of "+" methods such as Integer#+.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Rarray.sum(init = 0) -> object
array.sum(init = 0) {|element| ... } -> object
;T0[I"(*args);T@@FI"
Array;TcRDoc::NormalClass00