{"id":1693,"date":"2017-06-08T10:27:36","date_gmt":"2017-06-08T10:27:36","guid":{"rendered":"https:\/\/www.botreetechnologies.com\/blog\/?p=1693"},"modified":"2020-12-08T13:08:50","modified_gmt":"2020-12-08T07:38:50","slug":"ruby-basic-data-types","status":"publish","type":"post","link":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/","title":{"rendered":"Understanding Basic Ruby Data Types"},"content":{"rendered":"\n<p>When we start learning a programming language, we generally start by learning about data types in ruby, variables, operators, conditionals, looping and then into more of oops principles. In this post, we will see what is ruby on rails data type and how we can define it by different ways.<\/p>\n\n\n\n<p><i>Ruby has several data types. All ruby data types are based on classes. The following are the basic data types recognised in Ruby:<\/i><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Arrays<\/li><li>Hashes<\/li><li>Boolean<\/li><li>Symbols<\/li><li>Numbers<\/li><li>Strings<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Arrays<\/h2>\n\n\n\n<p>Ruby arrays are ordered collections of objects. They can hold objects like integer, number, hash, string, symbol or any other array.<\/p>\n\n\n\n<p>An array is a list of variables enclosed in square brackets and separated by commas like&nbsp;<b>[ 1, 2, 3 ]<\/b>.<\/p>\n\n\n\n<p>Its indexing starts with 0. The negative index starts with -1 from the end of the array. For example, -1 indicates last element of the array and 0 indicates first element of the array.<\/p>\n\n\n\n<p>There are many ways to create or initialise an array like&#8230;<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/ParthivPatel-BTC\/25940d5ed468b61ab960428b71d8b2c9.js\"><\/script><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hashes<\/h2>\n\n\n\n<p>A Hash is a collection of key-value pairs like this: &#8220;employee&#8221; =&gt; &#8220;salary&#8221;. key-value pair has an identifier that identify which variable of the hash you want to access and a variable to store in that position in the hash.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Define Hash<\/h3>\n\n\n\n<p>A blank hash can be declared using two curly braces&nbsp;<b>{}<\/b>. Here is an example of a Hash in Ruby:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>employee_ages = {<br>\n\"John\" =&gt; 31,<br>\n\"David\" =&gt; 25,<br>\n\"Mike\" =&gt; 23<br>\n}<\/code><\/p><\/blockquote>\n\n\n\n<p>The names (John, David, Mike) are the&nbsp;<i>keys<\/i>&nbsp;and 31, 25 ad 23 are the corresponding values.<\/p>\n\n\n\n<p><i>Another way to define a hash when your keys are Symbols,<\/i><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>employee_ages = {:John =&gt; 31, :David =&gt; 25}<br>\n=&gt; {:John=&gt;31, :David=&gt;25}<\/code><\/p><\/blockquote>\n\n\n\n<p><i>A Hash can also be created through its &#8216;new&#8217; method:<\/i><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>employee_ages = Hash.new<br>\nemployee_eges[\"John\"] = 31<\/code><\/p><\/blockquote>\n\n\n\n<p><i>We can also set the&nbsp;<b>default<\/b>&nbsp;value that returns when accessing keys are not exists in the Hash. If not defined the default value then it returns nil. We can pass this as an argument to&nbsp;::new.<\/i><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>employee_ages = Hash.new(0)<\/code><\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Fetch value from a&nbsp;Hash<\/h3>\n\n\n\n<p>You can retrieve values from a Hash using <b>[]<\/b>&nbsp;operator. Now, try finding the age of John from employee_ages hash, write the name of the object with square bracket and write key&nbsp;<i><b>John<\/b><\/i> inside the brackets. In this case the key is string so take the key in quotes.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>employee_ages[\"John\"]<br>\n=&gt; 31<br>\nOR<br>\nemployee_ages = {:John =&gt; 31, :David =&gt; 25}<br>\nemployee_ages[:John]<br>\n=&gt; 31<\/code><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Booleans<\/h2>\n\n\n\n<p>In our code, we need the boolean values in regular basis. We are taking lots of decision based on <b>true<\/b>&nbsp;or&nbsp;<b>false<\/b>.&nbsp;<b>true<\/b> is an instance of&nbsp;<b>TrueClass<\/b> and&nbsp;<b>false<\/b>&nbsp;is an instance of&nbsp;<b>FalseClass<\/b>. Let&#8217;s see how the boolean used in Ruby.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Boolean Operators<\/h3>\n\n\n\n<p>In Ruby there are three main boolean operators:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><b>!<\/b> (&#8220;single-bang&#8221;) which represents &#8220;NOT&#8221;,<\/li><li><b>&amp;&amp;<\/b> (&#8220;double-ampersand&#8221;) which represents &#8220;AND&#8221;, and<\/li><li><b>||<\/b> (&#8220;double-pipe&#8221;) which represents &#8220;OR&#8221;.<\/li><li><b>==<\/b> (&#8220;double-equal-sign&#8221;) which is for compare two values.<\/li><\/ul>\n\n\n\n<p>For an&nbsp;<b>&amp;&amp;<\/b> (&#8220;and&#8221;) to evaluate to&nbsp;<b>true<\/b>, both values of either side of the symbol must evaluate to&nbsp;<b>true<\/b>. For example:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>true &amp;&amp; true #=&gt; true<br>\ntrue &amp;&amp; false #=&gt; false<\/code><\/p><\/blockquote>\n\n\n\n<p>For an <b>||<\/b>&nbsp;(&#8220;or&#8221;) to evaluate to&nbsp;<b>true<\/b>, only one value on either side of the symbol must evaluate to&nbsp;<b>true<\/b>. For example:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>false || true #=&gt; true<\/code><\/p><\/blockquote>\n\n\n\n<p>A&nbsp;<b>!<\/b> (&#8220;not&#8221;) reverses the logical state of its operand: if a condition is&nbsp;<b>true<\/b>, then&nbsp;<b>!<\/b>&nbsp;will make it&nbsp;<b>false<\/b>; if it is&nbsp;<b>false<\/b>, then <b>!<\/b>&nbsp;will make it&nbsp;<b>true<\/b>. For example:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>!true #=&gt; false<br>\n!false #=&gt; true<\/code><\/p><\/blockquote>\n\n\n\n<p>To check if two values are equal, we use the&nbsp;<i>comparison operator<\/i>&nbsp;represented with&nbsp;<b>==<\/b>&nbsp;(&#8220;double-equal-sign&#8221;). If two values are equal, then the statement will return&nbsp;<b>true<\/b>. If they are not equal, then it will return&nbsp;<b>false<\/b>. For example:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>1 == 1 #=&gt; true<br>\n1 == 7 #=&gt; false<\/code><\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Other Comparison Operators<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"386\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/comparison-operators.png\" alt=\"Comparison Operators\" class=\"wp-image-13861\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/comparison-operators.png 1000w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/comparison-operators-300x116.png 300w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/comparison-operators-768x296.png 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Symbols<\/h2>\n\n\n\n<p>Symbol is similar to String but a symbol can&#8217;t be changed. It is a thing that has both a number (integer) representation and a string representation. is written like this:&nbsp;<i><b>:something.<\/b><\/i><\/p>\n\n\n\n<p>The symbol, however, is&nbsp;<i><b>immutable<\/b><\/i>. This means that its state can&#8217;t be modified after it is created and it will always be the same size in memory. The string referenced the same symbol many times.<\/p>\n\n\n\n<p>First we will see what class is uses a symbol:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>:hello.class<br>\n=&gt; Symbol<\/code><\/p><p><code>\"hello\".class<br>\n=&gt; String<\/code><\/p><\/blockquote>\n\n\n\n<p>You can also use the String methods like <i><b>upcase<\/b><\/i>,&nbsp;<b><i>downcase<\/i><\/b> and&nbsp;<i><b>capitalizeon<\/b><\/i> Symbols.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>:hello.upcase<br>\n=&gt; :HELLO<\/code><\/p><p><code>:HELLO.downcase<br>\n=&gt; :hello<\/code><\/p><p><code>:hello.capitalize<br>\n=&gt; :Hello<\/code><\/p><\/blockquote>\n\n\n\n<p>You can&#8217;t modify Symbol. You will get&nbsp;<b>NoMethodErrorerror<\/b> when you try to modify. See below..<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>:hello &lt;&lt; \" world\"<br>\n=&gt; NoMethodError: undefined method '&lt;&lt;' for :hello:Symbol<\/code><\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Symbols are better for performance<\/h3>\n\n\n\n<p>When you create two String objects with the same value, those two objects are treated as two different objects. When you create a Symbol, referencing the Symbol will always use the same object. See below results.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>\"philip\".object_id<br>\n=&gt; 70288511587360<br>\n\"philip\".object_id<br>\n=&gt; 70288504327720<\/code><\/p><p><code>:philip.object_id<br>\n=&gt; 539368<\/code><br><code>:philip.object_id<br>\n=&gt; 539368<\/code><\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">When should you use&nbsp;Symbols?<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><b>To Identify Something:<\/b> You should use Symbols when you want to identify something. For example a good use case of Symbols is for the keys of a Hash:<\/li><\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>person = {:name =&gt; \"John\"}<\/code><\/p><p>Or you can defines for String as:<\/p><p><code>person = {\"name\" =&gt; \"Philip\"}<\/code><\/p><p>You can also used as the name parameters of a method:<\/p><p><code>Person.age(:John =&gt; \"31\")<\/code><\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Used in method&nbsp;calls<\/h3>\n\n\n\n<p>Another use case is when you pass a Symbol into a method call, for example:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>people = [\"John\", \"Mike\", \"David\"]<br>\n=&gt; [\"John\", \"Mike\", \"David\"]<\/code><\/p><p><code>people.send(:pop)<br>\n=&gt; \"David\"<\/code><\/p><\/blockquote>\n\n\n\n<p>When you send the Symbol&nbsp;<b>:pop<\/b>&nbsp;into the method&nbsp;<b>send<\/b>, the&nbsp;<b>pop<\/b> method will be called on the object.<\/p>\n\n\n\n<p>Another way, you can use Symbol like<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>people.respond_to?(:map)<br>\n=&gt; true<\/code><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Numbers<\/h2>\n\n\n\n<p>Generally, we use two types of numbers&nbsp;<b>Fixnum<\/b> and&nbsp;<b>Float<\/b>.&nbsp;<b>Fixnum<\/b> known as an&nbsp;<b>Integer<\/b>. A number with no decimal point, e.g. 52.&nbsp;<b>Float<\/b> is basically with decimal points. e.g. 34.09988776.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Class Hierarchy<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"746\" height=\"175\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/class-hirerarchy.png\" alt=\"Class Hierarchy\" class=\"wp-image-13862\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/class-hirerarchy.png 746w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/class-hirerarchy-300x70.png 300w\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Ruby has two categories of numbers\u200a-\u200aintegers and floating-point (also called floats).<\/li><li>Integers are whole numbers that can be positive or negative but cannot be fractions.<\/li><li>Depending on their size,&nbsp;integers can have the class&nbsp;<b>Fixnum<\/b> or&nbsp;<b>Bignum<\/b>.<\/li><li>Floats are numbers with a decimal place.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Examples:<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code>x = 5.5<br>\nx.class<br>\n#=&gt; Floatx = 5<br>\nx.class<br>\n#=&gt; Fixnumx = 11122233344455566677<br>\nx.class<br>\n#=&gt; Bignum<\/code><\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Strings<\/h2>\n\n\n\n<p>In programming language, a string is a text. String is an object that represents a specific text. E.g. your name, paragraphs of this blog, strings are everywhere.<\/p>\n\n\n\n<p>There any many ways to define a String but most common way is&nbsp;<b>double quotes(&#8221; &#8220;)<\/b> and&nbsp;<b>single quotes(&#8216; &#8216;)<\/b><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&#8220;This is one String&#8221;<br>&#8216;And this is another one.&#8217;<\/p><\/blockquote>\n\n\n\n<p>Here are some methods we use to define a String in daily basis.<\/p>\n\n\n\n<p><script src=\"https:\/\/gist.github.com\/ParthivPatel-BTC\/930f54d01f260a9e9fa69314bd669546.js\"><\/script><\/p>\n\n\n\n<p>That&#8217;s it. These are the basic details and it&#8217;s usage of Ruby data types which we are using on a daily basis. I will explain all these data types with its methods in detail in my next blog.<\/p>\n\n\n\n<p>Thanks for reading.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.botreetechnologies.com\/ruby-on-rails-development\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Click here for more RoR blogs&#8230;<\/strong><\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>At <a href=\"https:\/\/www.botreetechnologies.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">BoTree Technologies<\/a>, we build enterprise applications with our RoR team of 25+ engineers.<\/p>\n\n\n\n<p>We also specialize in RPA, AI, Python, Django, JavaScript and ReactJS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"https:\/\/www.botreetechnologies.com\/contact\" target=\"_blank\" rel=\"noopener noreferrer\">Consulting is free<\/a> &#8211; let us help you grow!<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>When we start learning a programming language, we generally start&#8230;<\/p>\n","protected":false},"author":11,"featured_media":13860,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,10],"tags":[],"class_list":["post-1693","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-on-rails","category-technology"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Understanding Basic Ruby Data Types<\/title>\n<meta name=\"description\" content=\"Venturing into Ruby? Start with Ruby data types. Get simple information about the different data types in Ruby from this article. Once done, you&#039;ll know how helpful Ruby on Rails data types are.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Basic Ruby Data Types\" \/>\n<meta property=\"og:description\" content=\"Venturing into Ruby? Start with Ruby data types. Get simple information about the different data types in Ruby from this article. Once done, you&#039;ll know how helpful Ruby on Rails data types are.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\" \/>\n<meta property=\"og:site_name\" content=\"BoTree Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BoTreeTechnologies\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-08T10:27:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-08T07:38:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Parthiv Patel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:site\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Parthiv Patel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\"},\"author\":{\"name\":\"Parthiv Patel\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/33421652a86a8f62aa02d78c35b1f3c3\"},\"headline\":\"Understanding Basic Ruby Data Types\",\"datePublished\":\"2017-06-08T10:27:36+00:00\",\"dateModified\":\"2020-12-08T07:38:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\"},\"wordCount\":1081,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg\",\"articleSection\":[\"Ruby on Rails\",\"Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\",\"name\":\"Understanding Basic Ruby Data Types\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg\",\"datePublished\":\"2017-06-08T10:27:36+00:00\",\"dateModified\":\"2020-12-08T07:38:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/33421652a86a8f62aa02d78c35b1f3c3\"},\"description\":\"Venturing into Ruby? Start with Ruby data types. Get simple information about the different data types in Ruby from this article. Once done, you'll know how helpful Ruby on Rails data types are.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg\",\"width\":1280,\"height\":960,\"caption\":\"ruby basic data types\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.botreetechnologies.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding Basic Ruby Data Types\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/\",\"name\":\"BoTree Technologies\",\"description\":\"Committed to inspire generation.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/33421652a86a8f62aa02d78c35b1f3c3\",\"name\":\"Parthiv Patel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/parthiv-patel-150x150.png\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/parthiv-patel-150x150.png\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/parthiv-patel-150x150.png\",\"caption\":\"Parthiv Patel\"},\"description\":\"Parthiv is a Ruby on Rails Engineer. He has strong experience in javascript and DevOps activities like deployment, installation, server, and domain configuration, maintenance, and support of any platform like AWS, digital ocean and Heroku. He develops applications with optimization and clean code with full Rspec coverage.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding Basic Ruby Data Types","description":"Venturing into Ruby? Start with Ruby data types. Get simple information about the different data types in Ruby from this article. Once done, you'll know how helpful Ruby on Rails data types are.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/","og_locale":"en_US","og_type":"article","og_title":"Understanding Basic Ruby Data Types","og_description":"Venturing into Ruby? Start with Ruby data types. Get simple information about the different data types in Ruby from this article. Once done, you'll know how helpful Ruby on Rails data types are.","og_url":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/","og_site_name":"BoTree Technologies","article_publisher":"https:\/\/www.facebook.com\/BoTreeTechnologies\/","article_published_time":"2017-06-08T10:27:36+00:00","article_modified_time":"2020-12-08T07:38:50+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg","type":"image\/jpeg"}],"author":"Parthiv Patel","twitter_card":"summary_large_image","twitter_creator":"@BoTreeTech","twitter_site":"@BoTreeTech","twitter_misc":{"Written by":"Parthiv Patel","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#article","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/"},"author":{"name":"Parthiv Patel","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/33421652a86a8f62aa02d78c35b1f3c3"},"headline":"Understanding Basic Ruby Data Types","datePublished":"2017-06-08T10:27:36+00:00","dateModified":"2020-12-08T07:38:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/"},"wordCount":1081,"commentCount":0,"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg","articleSection":["Ruby on Rails","Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/","url":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/","name":"Understanding Basic Ruby Data Types","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage"},"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg","datePublished":"2017-06-08T10:27:36+00:00","dateModified":"2020-12-08T07:38:50+00:00","author":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/33421652a86a8f62aa02d78c35b1f3c3"},"description":"Venturing into Ruby? Start with Ruby data types. Get simple information about the different data types in Ruby from this article. Once done, you'll know how helpful Ruby on Rails data types are.","breadcrumb":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#primaryimage","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2017\/06\/ruby-basic-data-type.jpeg","width":1280,"height":960,"caption":"ruby basic data types"},{"@type":"BreadcrumbList","@id":"https:\/\/www.botreetechnologies.com\/blog\/ruby-basic-data-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.botreetechnologies.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Understanding Basic Ruby Data Types"}]},{"@type":"WebSite","@id":"https:\/\/www.botreetechnologies.com\/blog\/#website","url":"https:\/\/www.botreetechnologies.com\/blog\/","name":"BoTree Technologies","description":"Committed to inspire generation.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/33421652a86a8f62aa02d78c35b1f3c3","name":"Parthiv Patel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/parthiv-patel-150x150.png","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/parthiv-patel-150x150.png","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/parthiv-patel-150x150.png","caption":"Parthiv Patel"},"description":"Parthiv is a Ruby on Rails Engineer. He has strong experience in javascript and DevOps activities like deployment, installation, server, and domain configuration, maintenance, and support of any platform like AWS, digital ocean and Heroku. He develops applications with optimization and clean code with full Rspec coverage."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/1693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=1693"}],"version-history":[{"count":1,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/1693\/revisions"}],"predecessor-version":[{"id":13863,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/1693\/revisions\/13863"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media\/13860"}],"wp:attachment":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=1693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=1693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=1693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}