Posts by Lucas Cordeiro • 11 points
5 posts
-
0
votes1
answer182
viewsQ: Identify number in array and change to a string
I’m trying to trade divisible numbers for 3 for a word inside my array. I tried to add my if within the array and with no result. def code( n ) if n % 3 == 0 Array.new(n + 1) { |i| i } end…
-
0
votes2
answers92
viewsA: Return the Fibonnaci elements from the term passed to the first
I did as Maniero said, I just made a few minor changes ! Code: def elements(n) return [0] if n == 0 return [0] if n == 1 return [0, 1, 1] if n == 2 lista = elements(n - 1) lista << lista[-2] +…
-
-1
votes2
answers92
viewsQ: Return the Fibonnaci elements from the term passed to the first
I have made the return of some specific elements already, but I am trying to return up to the first. In the code below I returned a certain element, as I create from now until the first, until the…
-
0
votes4
answers261
viewsQ: Sequencia Fibonacci
I’m doing a selection process, and they’re asking me to create a Fibonacci sequence, only I don’t know how to create, I even tried (code below) but I didn’t get any results. I have to return element…
-
0
votes1
answer23
viewsQ: Method returns me as null
When I create my code below, it returns me this error message, saying that my method is undefined for nil (undefined method 'errors' for nil:NilClass) Code: <ul> <%…