Skip to content

Commit c210d9a

Browse files
authored
Merge pull request #770 from travissarles/unified-types
fixed url typo and styles
2 parents 1692b5f + 6c8d46b commit c210d9a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tutorials/tour/_posts/2017-02-13-unified-types.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ prerequisite-knowledge: classes, basics
1414

1515
In Scala, all values have a type, including numerical values and functions. The diagram below illustrates a subset of the type hierarchy.
1616

17-
![Scala Type Hierarchy]({{ site.baseurl }}/tutorial/tour/unified-types-diagram.svg)
17+
<a href="/tutorials/tour/unified-types-diagram.svg"><img style="width:100%" src="/tutorials/tour/unified-types-diagram.svg" alt="Scala Type Hierarchy"></a>
1818

1919
## Scala Type Hierarchy ##
2020

@@ -49,23 +49,29 @@ c
4949
true
5050
<function>
5151
```
52+
5253
## Type Casting
5354
Value types can be cast in the following way:
54-
![Scala Type Hierarchy]({{ site.baseurl }}/tutorial/tour/type-casting-diagram.svg)
55+
<a href="/tutorials/tour/type-casting-diagram.svg"><img style="width:100%" src="/tutorials/tour/type-casting-diagram.svg" alt="Scala Type Hierarchy"></a>
56+
5557
For example:
58+
5659
```tut
5760
val x: Long = 987654321
5861
val y: Float = x // 9.8765434E8 (note that some precision is lost in this case)
5962
6063
val face: Char = '☺'
6164
val number: Int = face // 9786
6265
```
66+
6367
Casting is unidirectional. This will not compile:
68+
6469
```
6570
val x: Long = 987654321
6671
val y: Float = x // 9.8765434E8
6772
val z: Long = y // Does not conform
6873
```
74+
6975
You can also cast a reference type to a subtype. This will be covered later in the tour.
7076

7177
## Nothing and Null

0 commit comments

Comments
 (0)