Functions Parameters

3 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
€87.01
List Price:  €121.82
You save:  €34.81
£74.79
List Price:  £104.71
You save:  £29.92
CA$138.36
List Price:  CA$193.71
You save:  CA$55.35
A$156.17
List Price:  A$218.65
You save:  A$62.47
S$130.73
List Price:  S$183.03
You save:  S$52.29
HK$775.70
List Price:  HK$1,086.01
You save:  HK$310.31
CHF 81.11
List Price:  CHF 113.56
You save:  CHF 32.44
NOK kr1,034.66
List Price:  NOK kr1,448.56
You save:  NOK kr413.90
DKK kr649.63
List Price:  DKK kr909.51
You save:  DKK kr259.88
NZ$166.51
List Price:  NZ$233.12
You save:  NZ$66.61
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.91
৳12,143.18
List Price:  ৳17,000.94
You save:  ৳4,857.76
₹8,517.31
List Price:  ₹11,924.57
You save:  ₹3,407.26
RM438.95
List Price:  RM614.55
You save:  RM175.60
₦160,455.95
List Price:  ₦224,644.75
You save:  ₦64,188.80
₨28,047.19
List Price:  ₨39,267.19
You save:  ₨11,220
฿3,321.64
List Price:  ฿4,650.43
You save:  ฿1,328.79
₺3,825.75
List Price:  ₺5,356.21
You save:  ₺1,530.45
B$580.81
List Price:  B$813.15
You save:  B$232.34
R1,863.68
List Price:  R2,609.22
You save:  R745.54
Лв170.05
List Price:  Лв238.07
You save:  Лв68.02
₩142,434.57
List Price:  ₩199,414.10
You save:  ₩56,979.52
₪371.58
List Price:  ₪520.23
You save:  ₪148.64
₱5,666.88
List Price:  ₱7,933.86
You save:  ₱2,266.97
¥14,044.32
List Price:  ¥19,662.61
You save:  ¥5,618.29
MX$1,964.06
List Price:  MX$2,749.77
You save:  MX$785.70
QR364.06
List Price:  QR509.70
You save:  QR145.64
P1,377.36
List Price:  P1,928.36
You save:  P551
KSh12,968.70
List Price:  KSh18,156.70
You save:  KSh5,188
E£5,105.84
List Price:  E£7,148.38
You save:  E£2,042.54
ብር13,093.69
List Price:  ብር18,331.69
You save:  ብር5,238
Kz91,740.82
List Price:  Kz128,440.82
You save:  Kz36,700
CLP$96,144.23
List Price:  CLP$134,605.76
You save:  CLP$38,461.53
CN¥729.16
List Price:  CN¥1,020.86
You save:  CN¥291.69
RD$5,974.40
List Price:  RD$8,364.40
You save:  RD$2,390
DA13,191.38
List Price:  DA18,468.46
You save:  DA5,277.08
FJ$225
List Price:  FJ$315.01
You save:  FJ$90.01
Q770.11
List Price:  Q1,078.19
You save:  Q308.07
GY$20,971.40
List Price:  GY$29,360.80
You save:  GY$8,389.40
ISK kr12,607.73
List Price:  ISK kr17,651.33
You save:  ISK kr5,043.60
DH923.87
List Price:  DH1,293.46
You save:  DH369.58
L1,727.84
List Price:  L2,419.05
You save:  L691.20
ден5,350.32
List Price:  ден7,490.67
You save:  ден2,140.34
MOP$798.94
List Price:  MOP$1,118.55
You save:  MOP$319.61
N$1,876.81
List Price:  N$2,627.61
You save:  N$750.80
C$3,677.16
List Price:  C$5,148.17
You save:  C$1,471.01
रु13,633.12
List Price:  रु19,086.91
You save:  रु5,453.79
S/370.41
List Price:  S/518.59
You save:  S/148.18
K406.40
List Price:  K568.98
You save:  K162.58
SAR375.06
List Price:  SAR525.10
You save:  SAR150.04
ZK2,847.18
List Price:  ZK3,986.17
You save:  ZK1,138.98
L433.04
List Price:  L606.28
You save:  L173.23
Kč2,180.17
List Price:  Kč3,052.33
You save:  Kč872.15
Ft35,589.07
List Price:  Ft49,826.13
You save:  Ft14,237.05
SEK kr949.26
List Price:  SEK kr1,329.01
You save:  SEK kr379.74
ARS$109,240.97
List Price:  ARS$152,941.73
You save:  ARS$43,700.76
Bs691.72
List Price:  Bs968.44
You save:  Bs276.71
COP$425,733.06
List Price:  COP$596,043.32
You save:  COP$170,310.25
₡50,248.77
List Price:  ₡70,350.29
You save:  ₡20,101.51
L2,584.74
List Price:  L3,618.74
You save:  L1,033.99
₲799,721.01
List Price:  ₲1,119,641.41
You save:  ₲319,920.40
$U4,234.41
List Price:  $U5,928.35
You save:  $U1,693.93
zł372.68
List Price:  zł521.77
You save:  zł149.09
Already have an account? Log In

Transcript

Hello, welcome to the 17th tutorial and the swift programming series. And in this part we'll learn look at function parameters in the previous part, we looked at functions. Function basically allows you to group code or you can call it several times function parameter, the latest send values to those functions when it is called, for example, a simple math function may add two numbers together, obviously, it can do more complex stuff in your program, and you most likely will, but we're just going to implement a simple math function that like was said, in that just add the numbers together. So what we're going to do is first is declare a function, we're going to call print math function. And then to declare the parameters, you put it within the brackets. So you put the parameter name or the local parameter.

Now I should take it outside the function, you can't be accessed and then you put a colon and it's data type. Gonna put in number comma first my lead number to hold on. And so bracker break point, what we're gonna do is just cram from line number one, time. Number two, they're spending number one, and number 2am printed out when this function is called the mean Yeah, print math function, they specify the numbers, they can also be variable, the orange area, or perhaps it could be something like a float and you cast it to an int, which we talked about typecasting earlier on in the series. So convert five and seven, so those should be 35. Now we're gonna only have a result of 35.

But if I just get rid of these, it no longer works because obviously, these are function call this but what you can do with an extra finger show you land on the basic function. Now if I run this, you'll run the regular ones in one without parameters. So the compiler is smart enough to know that Oh, you're calling a function, we have no parameters to function with that name, but you call it your window parameter. So we'll just call this He called this slide, obviously, but if you put a parameter in there, though, six, and eight, so you should get the result of 48 equals this one. So that's it for this tutorial. The next tutorial we're gonna look at the function return statement.

If you have any questions, feel free to message us at support our solar system. Correct. Okay, the email will be in the description. You can comment on this video or just directly message us by YouTube. All the requirements for the source code 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.