<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: roxor</title>
    <description>The latest articles on DEV Community by roxor (@roxor).</description>
    <link>https://dev.to/roxor</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F268032%2Fab621510-d5be-4caf-943a-90f1537314c8.jpg</url>
      <title>DEV Community: roxor</title>
      <link>https://dev.to/roxor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/roxor"/>
    <language>en</language>
    <item>
      <title>First Half. Ruby noob question</title>
      <dc:creator>roxor</dc:creator>
      <pubDate>Thu, 28 Apr 2022 16:18:13 +0000</pubDate>
      <link>https://dev.to/roxor/first-half-ruby-noob-question-1pin</link>
      <guid>https://dev.to/roxor/first-half-ruby-noob-question-1pin</guid>
      <description>&lt;p&gt;I'm doing some exercises in ruby, my task was this&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Write a method **first_half(array)** that takes in an array and returns a new array containing the first half of the elements in the array. If there is_ an odd number of elements_, return the first half including the middle element.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;My solution was this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def first_half(array)
  new_arr = []
  i = 0
  while i &amp;lt; array.length / 2.0
    new_arr &amp;lt;&amp;lt; array[i]

    i += 1
  end

  return new_arr

end

print first_half(["Brian", "Abby", "David", "Ommi"])# =&amp;gt; ["Brian", "Abby"]
puts
print first_half(["a", "b", "c", "d", "e"]) # =&amp;gt; ["a", "b", "c"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;end this works, but when I change 2.0 to 2.5 editor show only my first two elements "a" and "b". &lt;em&gt;Any explanation why?&lt;/em&gt; &lt;br&gt;
Maybe I just overthink this and this is something stupid... &lt;/p&gt;

&lt;p&gt;I just want to hear different thoughts&lt;/p&gt;

&lt;p&gt;thanks in advance &amp;lt;3&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>ruby</category>
    </item>
    <item>
      <title>100 days of coding - Day 3</title>
      <dc:creator>roxor</dc:creator>
      <pubDate>Thu, 20 Jan 2022 21:01:07 +0000</pubDate>
      <link>https://dev.to/roxor/100-days-of-coding-day-2-2o9b</link>
      <guid>https://dev.to/roxor/100-days-of-coding-day-2-2o9b</guid>
      <description>&lt;h2&gt;
  
  
  Methods
&lt;/h2&gt;

&lt;p&gt;Method or Function?&lt;/p&gt;

&lt;p&gt;Don't have a clue what is difference between two of these, but for now most important to learn how they working. Later I will write about differences &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;In Ruby we will called this methods.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parentheses?&lt;/strong&gt;&lt;br&gt;
Ruby is very flexible language. When method expect some results we use parentheses, if not we don't need parentheses. But methods will works in both cases. See example bellow&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def something
   puts "Hello World"
end

# this is two valid ways to call the _something_ methods

something  # this is preferred since something methods 
doesn't expect any parameters

something()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, we prefer to call methods with parentheses in that scenario&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def something(name)
  puts "hey" + name
end

something("Ivan") # this is preferred since greet does 
expect parameters

something "Ivan"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also must make distinction between a &lt;strong&gt;&lt;em&gt;variable&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;parameter&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;argument&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Variables&lt;/strong&gt; are names who can hold the data. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;bottle = water&lt;/p&gt;

&lt;p&gt;bottle is variable that hold value "water"&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Parameter *&lt;/em&gt; are names that can hold a data in method.&lt;br&gt;
Parameter is placed in parentheses of method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def something(drink, eat)
    sentence =  "I like to eat " + food + " with a cup of "            
                + drink
    puts sentence
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above &lt;strong&gt;food&lt;/strong&gt; and &lt;strong&gt;drink&lt;/strong&gt; are parameters. &lt;strong&gt;sentence&lt;/strong&gt; is a normal variable; it is not a parameter:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arguments&lt;/strong&gt; are data that we pass in method when we call the method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def meal(food, drink)
  sentence =  "I like to eat " + food + " with a cup of " + drink
  puts sentence
end

meal("toast", "coffee") # Here we pass "toast" and "coffee" into our method.
meal("pancakes", "orange juice") # We can also pass "pancakes" and "orange juice" in another call
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"&lt;strong&gt;toast", "coffe", "pancakes", "orange juice"&lt;/strong&gt; are arguments&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>ruby</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>100 days of coding - Day 2</title>
      <dc:creator>roxor</dc:creator>
      <pubDate>Wed, 19 Jan 2022 21:00:22 +0000</pubDate>
      <link>https://dev.to/roxor/100-days-of-coding-day-2-2ock</link>
      <guid>https://dev.to/roxor/100-days-of-coding-day-2-2ock</guid>
      <description>&lt;p&gt;okay, for this day I do &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Strings
&lt;/h2&gt;

&lt;p&gt;Different waves to print and format your code.&lt;br&gt;
P, print, puts.&lt;br&gt;
String operations: + (concatenation), .length, and &lt;a href="https://dev.toindexing"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exercies&lt;/strong&gt;:&lt;br&gt;
**What is the index of g in the string "coding"?&lt;br&gt;
**What will "Hey-Programmers".length &amp;lt; 5 evaluate to?&lt;br&gt;
**What will "coding"[2] evaluate to?&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Variables
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Exercising&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Predict what the following puts lines with question marks will print out&lt;/p&gt;

&lt;p&gt;num = 40&lt;br&gt;
num + 5&lt;br&gt;
puts "---1:"&lt;br&gt;
puts num                   # ?&lt;/p&gt;

&lt;p&gt;num += 2&lt;br&gt;
puts "---2:"&lt;br&gt;
puts num                   # ?&lt;/p&gt;

&lt;p&gt;isEven = num % 2 == 0&lt;br&gt;
puts "---3:"&lt;br&gt;
puts isEven                # ?&lt;/p&gt;

&lt;p&gt;isNegative = num &amp;lt; 0&lt;br&gt;
puts "---4:"&lt;br&gt;
puts isNegative            # ?&lt;/p&gt;

&lt;p&gt;puts "---5:"&lt;br&gt;
puts isEven || isNegative  # ?&lt;/p&gt;

&lt;p&gt;puts "---6:"&lt;br&gt;
puts isEven &amp;amp;&amp;amp; isNegative  # ?&lt;/p&gt;

&lt;p&gt;puts "---7:"&lt;br&gt;
puts isEven &amp;amp;&amp;amp; !isNegative # ?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>100 days of coding - Day 1</title>
      <dc:creator>roxor</dc:creator>
      <pubDate>Tue, 18 Jan 2022 14:55:03 +0000</pubDate>
      <link>https://dev.to/roxor/100-days-of-coding-day-1-549e</link>
      <guid>https://dev.to/roxor/100-days-of-coding-day-1-549e</guid>
      <description>&lt;p&gt;I've been trying to get into the world of programming for a while now, but I always give up. Now I’m starting again and I want this to be my proof that I didn’t give up no matter how hard it was.&lt;/p&gt;

&lt;p&gt;I’m starting to learn through &lt;strong&gt;AppAcademy.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;For this day(Day 1 of 100), I decided to go for:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Numbers&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.Booleans&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>codenewbie</category>
      <category>ruby</category>
    </item>
    <item>
      <title>exercise</title>
      <dc:creator>roxor</dc:creator>
      <pubDate>Sun, 19 Dec 2021 15:25:17 +0000</pubDate>
      <link>https://dev.to/roxor/exercise-4bll</link>
      <guid>https://dev.to/roxor/exercise-4bll</guid>
      <description>&lt;p&gt;Create a new string sorted from smallest to largest.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/DjordjeStoj/embed/gORGMXx?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>JavaScript beginner help</title>
      <dc:creator>roxor</dc:creator>
      <pubDate>Sun, 16 Feb 2020 18:58:03 +0000</pubDate>
      <link>https://dev.to/roxor/javascript-beginner-help-21ie</link>
      <guid>https://dev.to/roxor/javascript-beginner-help-21ie</guid>
      <description>&lt;p&gt;Hey guys,&lt;/p&gt;

&lt;p&gt;I have been studying JavaScript for 3 weeks already. I'm stuck with function and these 3 tasks. If anyone could help me I would really appreciate it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Write  &lt;strong&gt;&lt;em&gt;sum&lt;/em&gt;&lt;/strong&gt; function that returns the sum of cubes of numbers from n to m.&lt;br&gt;
Call the function and print its result in the console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write function &lt;strong&gt;&lt;em&gt;year&lt;/em&gt;&lt;/strong&gt; that passes the Birth parameter.&lt;br&gt;
Birth year parameter represents the birth year of a person. The function should return how old a person is.&lt;br&gt;
The number of years a person has calculated based on their birth year and the current year that you can pull from your computer.&lt;br&gt;
Call the function and print the result in the console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write function &lt;strong&gt;&lt;em&gt;divisible&lt;/em&gt;&lt;/strong&gt; by passing three parameters n, m and k. The function on the screen should print the number of numbers n to m that is divisible by k. Call the function&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>help</category>
    </item>
  </channel>
</rss>
