

{"id":13213,"date":"2018-04-12T05:20:10","date_gmt":"2018-04-12T05:20:10","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=13213"},"modified":"2021-12-04T10:16:31","modified_gmt":"2021-12-04T04:46:31","slug":"scala-data-types","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/scala-data-types\/","title":{"rendered":"Scala Data Types with Examples | Escape Value &amp; Typecasting"},"content":{"rendered":"<h3>Scala Data Types<\/h3>\n<p>Hello, readers! Welcome back to learning Scala with DataFlair. Today, we will discuss Scala Data Types with basic literals, Escape value, typecasting and its examples.<\/p>\n<p>So, let&#8217;s start the Scala Data Types Tutorial.<\/p>\n<div id=\"attachment_13217\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13217\" class=\"wp-image-13217 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01.jpg\" alt=\"Scala Data Types with Examples | Escape Value &amp;amp; Typecasting\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-13217\" class=\"wp-caption-text\">Scala Data Types with Examples | Escape Value &amp; Typecasting<\/p><\/div>\n<h3>Introduction to Data Types in Scala<\/h3>\n<p>Like every other language, Scala has a type for every value. We saw this when we discussed variables and values. Even functions have a value. So, let\u2019s understand the Scala data types hierarchy for unified types.<\/p>\n<div id=\"attachment_13222\" style=\"width: 1767px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13222\" class=\"wp-image-13222 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types.png\" alt=\"Introduction to Scala Data Types\" width=\"1757\" height=\"531\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types.png 1757w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types-150x45.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types-300x91.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types-768x232.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Unified-Types-1024x309.png 1024w\" sizes=\"auto, (max-width: 1757px) 100vw, 1757px\" \/><\/a><p id=\"caption-attachment-13222\" class=\"wp-caption-text\">Introduction to Scala Data Types<\/p><\/div>\n<p>Here, the supertype for all types is Any. It has universal methods like equals, hashCode, and toString.<\/p>\n<p>Any parents two subclasses: AnyVal and AnyRef.<\/p>\n<p>AnyVal represents value types. The nine predefined and non-nullable value types are: Double, Float, Long, Int, Short, Byte, Char, Unit, and Boolean. We\u2019ll discuss these values in a short while. AnyRef represents reference types. A user-defined type is a subtype of this. And in the context of a JRE, AnyRef corresponds to java.lang.Object.<\/p>\n<p>Lets now directly jump to the Scala Data Types.<\/p>\n<h3>Scala Data Types<\/h3>\n<p>Let\u2019s discuss the basic in-built Scala data types in detail.<\/p>\n<h4>a. Scala Byte<\/h4>\n<p>Size: 8-bit<br \/>\nSigned value<br \/>\nRange: -128 to 127<\/p>\n<h4>b. Scala Short<\/h4>\n<p>Size: 16-bit<br \/>\nSigned value<br \/>\nRange: -32768 to 32767<\/p>\n<h4>c. Scala Int<\/h4>\n<p>Size: 32-bit<br \/>\nSigned value<br \/>\nRange: &#8211; 2147483648 to 2147483647<\/p>\n<h4>d. Scala Long<\/h4>\n<p>Size: 64-bit<br \/>\nSigned value<br \/>\nRange: -9223372036854775808 to 9223372036854775807<\/p>\n<h4>e. Scala Float<\/h4>\n<p>Size: 32-bit<br \/>\nIt follows the IEEE 754 standard, and is a single-precision float.<\/p>\n<h4>f. Scala Double<\/h4>\n<p>Size: 32-bit<br \/>\nIt follows the IEEE 754 standard, and is a double-precision float.<\/p>\n<h4>g. Scala Char<\/h4>\n<p>Size: 16-bit<br \/>\nIt is an unsigned Unicode character<br \/>\nRange: U+0000 to U+FFFF<\/p>\n<h4>h. Scala String<\/h4>\n<p>A string is a sequence of Chars.<\/p>\n<h4>i. Scala Boolean<\/h4>\n<p>A Boolean value is either true or false.<\/p>\n<h4>j. Scala Unit<\/h4>\n<p>There is only one instance of unit, and that is (). It carries no meaningful information. And since all functions must return something, sometimes, we have them return Unit.<\/p>\n<h4>k. Scala Null<\/h4>\n<p>This refers to an empty or null reference. It is a subtype of all reference types. This makes it a subtype of any subtype of AnyRef. Null helps with interoperability with other JVM languages, and we almost never use it.<\/p>\n<h4>l. Scala Nothing<\/h4>\n<p>Nothing is a subtype to every other type. And trust us, it holds no value at all.<br \/>\nSince it is a subtype of all types, we also call it the bottom type. Actually, no value is of type Nothing. So where would we use it? We can use it to signal non-termination like a thrown exception, program exit, or an infinite loop.<\/p>\n<h4>m. Scala Any<\/h4>\n<p>This is the supertype for all other types. This means that any object is of the type Any.<\/p>\n<h4>n. Scala AnyVal<\/h4>\n<p>This represents value types.<\/p>\n<h4>o. Scala AnyRef<\/h4>\n<p>AnyRef represents reference types.<\/p>\n<p>Since all these Scala Data types are objects and not primitives, it is possible to call methods on these objects.<\/p>\n<h3>Basic Literals<\/h3>\n<p>In this section, we will see integral, floating point, Boolean, symbol, character, and string literals in Scala. We will also see multi-line strings and null values.<\/p>\n<h4>a. Integral Literals<\/h4>\n<p>These are usually Ints. When we use an \u2018l\u2019 or \u2018L\u2019 suffix, these are Longs.<br \/>\nSome valid integral literals:<br \/>\n07<br \/>\n7<br \/>\n111<br \/>\n0xFFFFFFFF<br \/>\n0798L<\/p>\n<h4>b. Floating-Point Literals<\/h4>\n<p>We\u2019ve seen floating-point numbers like 7.0 and 7.7 rather than 7. When there\u2019s a suffix of \u2018f\u2019 or \u2018F\u2019, these are of type Float. Otherwise, they\u2019re of type Double.<br \/>\nSome valid floating-point literals:<br \/>\n0.0<br \/>\n1e70f<br \/>\n3.24179f<br \/>\n1.0e100<br \/>\n.1<\/p>\n<h4>c. Boolean Literals<\/h4>\n<p>We have two Boolean literals- true and false.<\/p>\n<h4>d. Symbol Literals<\/h4>\n<p>Scala has a Symbol case class:<\/p>\n<pre class=\"EnlighterJSRAW\">package scala\r\nfinal case class Symbol private (name: String) {\r\noverride def toString: String = \"'\" + name\r\n}<\/pre>\n<p>So, a symbol \u2018x\u2019 is equivalent to scala.Symbol(\u201cx\u201d).<\/p>\n<h4>e. Character Literals<\/h4>\n<p>This is a single character delimited by quotes. A character is a printable Unicode character, and can be described by an escape sequence. We\u2019ll discuss escape sequences next.<br \/>\nSome valid character literals:<br \/>\n&#8216;a&#8217;<br \/>\n&#8216;\\n&#8217;<br \/>\n&#8216;\\u0042&#8217;<br \/>\n&#8216;\\t&#8217;<\/p>\n<h4>f. String Literals<\/h4>\n<p>Such a literal is a sequence of characters delimited by double quotes.<br \/>\nSome valid string literals:<br \/>\n\u201cHannah\\nMontana\u201d<br \/>\n\u201cAnd then she said, \\\u201dBe here now is a dog\u2019s purpose\\\u201d\u201d<\/p>\n<h4>g. Multi-line Strings<\/h4>\n<p>Like in Python, we can use three sets of double quotes to delimit a string to span it across multiple lines.<br \/>\nA valid multi-line string:<br \/>\n\u201c\u201d\u201dThe first line<br \/>\nThe second line\\n<br \/>\nThe fourth line\u201d\u201d\u201d<\/p>\n<h4>h. Null Values<\/h4>\n<p>A null value has the type scala.Null. This makes it compatible with each reference type. But what is really denotes is a reference value referring to a special \u2018null\u2019 object.<\/p>\n<p>Any doubt yet in Scala Data Types.<\/p>\n<h3>Escape Values<\/h3>\n<p>An escape value is a backslash with a character that will escape that character to execute a certain functionality. We can use these in character and string literals. We have the following escape values in Scala:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Escape Sequences<\/b><\/td>\n<td><b>Unicode<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td>\\b<\/td>\n<td>\\u0008<\/td>\n<td>Backspace BS<\/td>\n<\/tr>\n<tr>\n<td>\\t<\/td>\n<td>\\u0009<\/td>\n<td>Horizontal Tab HT<\/td>\n<\/tr>\n<tr>\n<td>\\n<\/td>\n<td>\\u000a<\/td>\n<td>Newline<\/td>\n<\/tr>\n<tr>\n<td>\\f<\/td>\n<td>\\u000c<\/td>\n<td>Formfeed FF<\/td>\n<\/tr>\n<tr>\n<td>\\r<\/td>\n<td>\\u000d<\/td>\n<td>Carriage Return CR<\/td>\n<\/tr>\n<tr>\n<td>\\\u201d<\/td>\n<td>\\u0022<\/td>\n<td>Double quote \u201c<\/td>\n<\/tr>\n<tr>\n<td>\\\u201d<\/td>\n<td>\\u0027<\/td>\n<td>Single quote \u2018<\/td>\n<\/tr>\n<tr>\n<td>\\\\<\/td>\n<td>\\u005c<\/td>\n<td>Backslash \\<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>We can also represent characters with Unicodes between 0 and 255 with octal escapes (using backslashes). Upto three octal characters may follow. Take an example:<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; println(\"Hey, how \\b are you?\\n\\tI've been\\r...\\\"waiting\\\"\")<\/pre>\n<p>Hey, how are you?<br \/>\n&#8230;&#8221;waiting&#8221; been<\/p>\n<h3>Type Casting<\/h3>\n<p>In Scala, we can convert one type to another:<\/p>\n<div id=\"attachment_13218\" style=\"width: 823px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/type-casting.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13218\" class=\"wp-image-13218 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/type-casting.png\" alt=\"Scala Data Types: Type Casting\" width=\"813\" height=\"219\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/type-casting.png 813w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/type-casting-150x40.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/type-casting-300x81.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/type-casting-768x207.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/a><p id=\"caption-attachment-13218\" class=\"wp-caption-text\">Scala Data Types: Type Casting<\/p><\/div>\n<p>Let\u2019s take an example.<\/p>\n<pre class=\"EnlighterJSRAW\">scala&gt; val a:Int=7\r\na: Int = 7\r\nscala&gt; val b:Float=a\r\nb: Float = 7.0\r\nHmm, let\u2019s take another example to make it clear.\r\nscala&gt; val c:Char='a'\r\nc: Char = a\r\nscala&gt; val d:Int=c\r\nd: Int = 97\r\nscala&gt; val e:Char='A'\r\ne: Char = A\r\nscala&gt; val f:Float=e\r\nf: Float = 65.0<\/pre>\n<p>This was all on Scala Data Types<\/p>\n<h3>Conclusion<\/h3>\n<p>This is all about Scala Data Types. Doesn\u2019t it feel just a bit different than Java and C++, yet so similar? Let us know in the comments if you have any doubts.<\/p>\n<p><a href=\"https:\/\/docs.scala-lang.org\/style\/types.html\"><strong>Reference<\/strong><\/a><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1989,&quot;href&quot;:&quot;https:\\\/\\\/docs.scala-lang.org\\\/style\\\/types.html&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20250717070512\\\/https:\\\/\\\/docs.scala-lang.org\\\/style\\\/types.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-10 15:30:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-18 17:16:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-07 07:20:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-20 10:01:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-17 12:28:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 20:43:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-22 12:32:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-27 09:20:40&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-07 10:58:00&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-14 01:40:45&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-19 15:08:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-26 12:01:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-02 14:30:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-06 07:47:26&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-06 07:47:26&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scala Data Types Hello, readers! Welcome back to learning Scala with DataFlair. Today, we will discuss Scala Data Types with basic literals, Escape value, typecasting and its examples. So, let&#8217;s start the Scala Data&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":31122,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[12409,12433,12436,12456,12477,12490,12583],"class_list":["post-13213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scala","tag-scala-char","tag-scala-data-types","tag-scala-double","tag-scala-float","tag-scala-int","tag-scala-literals","tag-scala-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Scala Data Types with Examples | Escape Value &amp; Typecasting - DataFlair<\/title>\n<meta name=\"description\" content=\"Scala Data Types: Learn Data Types in Scala with discussion on basic literals, Escape value, typecasting and its examples\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/scala-data-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scala Data Types with Examples | Escape Value &amp; Typecasting - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Scala Data Types: Learn Data Types in Scala with discussion on basic literals, Escape value, typecasting and its examples\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/scala-data-types\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-12T05:20:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-04T04:46:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Scala Data Types with Examples | Escape Value &amp; Typecasting - DataFlair","description":"Scala Data Types: Learn Data Types in Scala with discussion on basic literals, Escape value, typecasting and its examples","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:\/\/data-flair.training\/blogs\/scala-data-types\/","og_locale":"en_US","og_type":"article","og_title":"Scala Data Types with Examples | Escape Value &amp; Typecasting - DataFlair","og_description":"Scala Data Types: Learn Data Types in Scala with discussion on basic literals, Escape value, typecasting and its examples","og_url":"https:\/\/data-flair.training\/blogs\/scala-data-types\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-04-12T05:20:10+00:00","article_modified_time":"2021-12-04T04:46:31+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Scala Data Types with Examples | Escape Value &amp; Typecasting","datePublished":"2018-04-12T05:20:10+00:00","dateModified":"2021-12-04T04:46:31+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/"},"wordCount":969,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1.jpg","keywords":["Scala Char","Scala Data Types","scala double","scala float","scala int","Scala literals","scala tutorial"],"articleSection":["Scala Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/scala-data-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/","url":"https:\/\/data-flair.training\/blogs\/scala-data-types\/","name":"Scala Data Types with Examples | Escape Value &amp; Typecasting - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1.jpg","datePublished":"2018-04-12T05:20:10+00:00","dateModified":"2021-12-04T04:46:31+00:00","description":"Scala Data Types: Learn Data Types in Scala with discussion on basic literals, Escape value, typecasting and its examples","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/scala-data-types\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/04\/Scala-Data-Types-01-1.jpg","width":1200,"height":628,"caption":"Scala Data Types with Examples | Escape Value &amp; Typecasting"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/scala-data-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Scala Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/scala\/"},{"@type":"ListItem","position":3,"name":"Scala Data Types with Examples | Escape Value &amp; Typecasting"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/13213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=13213"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/13213\/revisions"}],"predecessor-version":[{"id":104796,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/13213\/revisions\/104796"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/31122"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=13213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=13213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=13213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}