Typecasting

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€89.58
List Price:  €125.41
You save:  €35.83
£75.27
List Price:  £105.39
You save:  £30.11
CA$139.69
List Price:  CA$195.57
You save:  CA$55.88
A$155.82
List Price:  A$218.15
You save:  A$62.33
S$130.07
List Price:  S$182.11
You save:  S$52.03
HK$781.33
List Price:  HK$1,093.90
You save:  HK$312.56
CHF 83.77
List Price:  CHF 117.28
You save:  CHF 33.51
NOK kr1,038.36
List Price:  NOK kr1,453.75
You save:  NOK kr415.38
DKK kr668.29
List Price:  DKK kr935.63
You save:  DKK kr267.34
NZ$170.05
List Price:  NZ$238.07
You save:  NZ$68.02
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳12,143.57
List Price:  ৳17,001.49
You save:  ৳4,857.91
₹8,549.19
List Price:  ₹11,969.21
You save:  ₹3,420.02
RM429.55
List Price:  RM601.39
You save:  RM171.84
₦160,722.33
List Price:  ₦225,017.70
You save:  ₦64,295.36
₨28,144.51
List Price:  ₨39,403.44
You save:  ₨11,258.93
฿3,339.15
List Price:  ฿4,674.95
You save:  ฿1,335.79
₺3,867.09
List Price:  ₺5,414.08
You save:  ₺1,546.99
B$566.19
List Price:  B$792.69
You save:  B$226.50
R1,803.95
List Price:  R2,525.61
You save:  R721.65
Лв175.36
List Price:  Лв245.51
You save:  Лв70.15
₩139,898
List Price:  ₩195,862.80
You save:  ₩55,964.80
₪356.22
List Price:  ₪498.72
You save:  ₪142.50
₱5,579.79
List Price:  ₱7,811.93
You save:  ₱2,232.13
¥14,563.04
List Price:  ¥20,388.84
You save:  ¥5,825.79
MX$1,947.04
List Price:  MX$2,725.94
You save:  MX$778.89
QR364.28
List Price:  QR510
You save:  QR145.72
P1,351.51
List Price:  P1,892.17
You save:  P540.66
KSh12,965.96
List Price:  KSh18,152.86
You save:  KSh5,186.90
E£5,009.57
List Price:  E£7,013.60
You save:  E£2,004.03
ብር13,248.67
List Price:  ብር18,548.67
You save:  ብር5,300
Kz91,690.83
List Price:  Kz128,370.83
You save:  Kz36,680
CLP$94,226.25
List Price:  CLP$131,920.52
You save:  CLP$37,694.27
CN¥720.84
List Price:  CN¥1,009.21
You save:  CN¥288.36
RD$5,889.41
List Price:  RD$8,245.41
You save:  RD$2,356
DA13,340
List Price:  DA18,676.54
You save:  DA5,336.53
FJ$227.36
List Price:  FJ$318.31
You save:  FJ$90.95
Q767.36
List Price:  Q1,074.33
You save:  Q306.97
GY$20,910.36
List Price:  GY$29,275.35
You save:  GY$8,364.98
ISK kr13,068.06
List Price:  ISK kr18,295.81
You save:  ISK kr5,227.74
DH930.65
List Price:  DH1,302.95
You save:  DH372.30
L1,734.89
List Price:  L2,428.91
You save:  L694.02
ден5,517.11
List Price:  ден7,724.17
You save:  ден2,207.06
MOP$804.52
List Price:  MOP$1,126.36
You save:  MOP$321.84
N$1,804.21
List Price:  N$2,525.97
You save:  N$721.75
C$3,674.63
List Price:  C$5,144.63
You save:  C$1,470
रु13,671.07
List Price:  रु19,140.05
You save:  रु5,468.97
S/368.48
List Price:  S/515.89
You save:  S/147.40
K406.73
List Price:  K569.44
You save:  K162.71
SAR375.03
List Price:  SAR525.07
You save:  SAR150.03
ZK2,686.52
List Price:  ZK3,761.24
You save:  ZK1,074.71
L457.37
List Price:  L640.34
You save:  L182.96
Kč2,230.30
List Price:  Kč3,122.51
You save:  Kč892.21
Ft36,085.39
List Price:  Ft50,520.99
You save:  Ft14,435.60
SEK kr977.76
List Price:  SEK kr1,368.90
You save:  SEK kr391.14
ARS$114,191.45
List Price:  ARS$159,872.60
You save:  ARS$45,681.15
Bs690.61
List Price:  Bs966.89
You save:  Bs276.27
COP$421,395.12
List Price:  COP$589,970.02
You save:  COP$168,574.90
₡50,625.01
List Price:  ₡70,877.03
You save:  ₡20,252.02
L2,599.74
List Price:  L3,639.74
You save:  L1,040
₲797,976.53
List Price:  ₲1,117,199.07
You save:  ₲319,222.53
$U4,171.18
List Price:  $U5,839.82
You save:  $U1,668.64
zł382.38
List Price:  zł535.35
You save:  zł152.97
Already have an account? Log In

Transcript

Hello and welcome to the fifth tutorial on the swift basics series and in this part we're going to be looking at typecasting, typecasting allows a value or variable to be converted to a particular data type. So, for example, and in Java to float or float to an integer, let's go ahead and open up our project and just show you how to implement this. So we are going to create a variable and call it i equal to nine. print this variable. What we have is the integer nine printed out but perhaps we want to find nine or we want this we want this to be a double. But if we say sign an integer to it initially, we'd still want it to be able to do that you can do one of two things either two colon, double.

Now when you print it out is 9.0. Even though the value nine which is an integer All signed off, and typecasted by Korean, the datatype here and then enclosed in the variable or the value and bracket and then this produces the same without another reason why this is useful if, for example, we do on equals 8.8. Runner it failed because 8.8 isn't an integer and we have nine signed to it initially which makes it an integer, but we can typecast it by putting int bracket, close bracket, run it and now is being typecast it to an int is truncated the number to eight. So typecasting is extremely useful if sometimes you have a few issues with rounding or some mathematical errors. So sometimes typecasting will help so that's it for this tutorial, we'll cover typecasting in the next tutorial we're going to cover how to add variables into strings.

If you have any questions feel free to message your support sonar systems. Korea okay the email in the description. You can comment on this video or directly messaged us via YouTube. The source code from This tutorial will also be in the description and as usual, thanks for watching and have a nice day.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.