User:AJFarmar: Difference between revisions

 
(3 intermediate revisions by the same user not shown)
Line 10:
 
==Ruby==
===Recent <code>String#word(Index)</code>:===
I made a little method that allowed me to replace <code>"String".split(" ")[index]</code> with <code>"String".word index</code>.
I know that this is relatively simple, but I still found it kinda neat.
Line 30:
 
dummy.word 3 #=> "dearsome,"
dummy.w 3 #=> "dearsome,"
 
<lang>
dummy.word 0..-1 #=>"Hello my deary, dearsome, deareary, dearlicious and dearful dearies!"
dummy.w 0..2 #=>"Hello my deary,"
</lang>
Anonymous user