PMphares muhambiinmuhambiphares.hashnode.dev·Aug 22, 2022 · 1 min readWhat is Pry?Pry is a REPL (Read, Evaluate, Print, Loop) that pauses your code wherever inserted and allows you to test/debug. When your code gets to the ‘pry’ it will freeze and your terminal will turn into a REPL right in the middle of your program. Using Pry T...00
PMphares muhambiinmuhambiphares.hashnode.dev·Aug 22, 2022 · 3 min readRuby Fundamentals: HashesHashes are basically like JavaScript objects. They are composed of key/value pairs and each key points to a specific value. For example; a_hash = { name: "John", age: "20" } a_hash[:age] # => "20" To access data from the hash above, bracket notation ...00
PMphares muhambiinmuhambiphares.hashnode.dev·Aug 22, 2022 · 2 min readRuby Fundamentals: ArraysIn Ruby, to access elements, bracket notation is used with the index of the element. fruits = ["banana", "mango", "pineapple"] fruits[0] # => "banana" fruits[1] # => "mango" Bracket notation can be used to update the elements as well. For example; f...00
PMphares muhambiinmuhambiphares.hashnode.dev·Aug 22, 2022 · 4 min readClass Variables and Methods in RubyClasses are like the blueprint from which individual objects are created. Class variables Class methods Private Methods Class Variables Class variables are used to store values related to a class in general rather than a particular instance. Cla...00
PMphares muhambiinmuhambiphares.hashnode.dev·Aug 22, 2022 · 2 min readArray IterationARRAY ITERATOR METHODS. WHAT IS ARRAY ITERATOR?.... An array is a single variable that is used to store different elements. Array iteration-This is used to traverse an array and dynamically access elements of that array. it operates on every array...00