WEBVTT

00:02.180 --> 00:02.920
Okay guys.

00:02.930 --> 00:04.070
And welcome back.

00:04.070 --> 00:09.410
Now to this point we will have a look at just using a single argument in our use of defying functions.

00:09.410 --> 00:12.100
But here we're going to have one where we're going to use two.

00:12.240 --> 00:18.100
Now obviously you can have as many as you like but you must remember the order in which they appear.

00:18.150 --> 00:22.200
So forget you don't get tooltip tips with user defined functions.

00:22.310 --> 00:26.880
So here what I do is are saying that that that.

00:27.050 --> 00:29.010
Am I going to say discount.

00:29.330 --> 00:31.040
Imagine the scenario.

00:31.280 --> 00:38.660
We have a business and we give people a discount depending on how many of our goodies that they buy.

00:38.660 --> 00:44.510
So here what I have is a custom function Shelp It's called discount calc.

00:44.570 --> 00:46.190
I have two arguments.

00:46.190 --> 00:48.890
I have my quantity which I'm going to type in here.

00:49.090 --> 00:54.170
I have my price which I'm going to type in here and this function is going to be used to derive the

00:54.170 --> 00:54.910
discount.

00:54.920 --> 00:58.880
So I have a couple of variables I have price break as integer.

00:58.940 --> 01:05.540
Imagine that we only sell in whole units and I have discounts as a single precision variable because

01:05.560 --> 01:10.930
I'm just going to be dealing with currency and discounts of a percent at a percentage.

01:10.970 --> 01:16.550
Okay so now what we need to do the first Test we need to see the parameters here the price break is

01:16.640 --> 01:23.900
1000 and if they breach 1000 melis they buy a thousand and one and then they're going to get a discount

01:23.900 --> 01:25.200
of 5 percent.

01:25.220 --> 01:32.090
So no what we need to do is add a logical test so we can actually test if the quantity entered is greater

01:32.090 --> 01:33.640
than a thousand or not.

01:33.710 --> 01:39.270
So we're just going to use a simple logical tessman say if my quantity.

01:39.290 --> 01:47.750
Well we can say if my quantity is less than or equal to Examiner site 1000 if I can just say price break

01:47.870 --> 01:54.630
their price break then then what do we want to do if it's less than that.

01:54.770 --> 02:00.470
We will say let me just add the end because I'm frequently forgetting to do this and now have the else

02:00.470 --> 02:00.800
as well.

02:00.800 --> 02:01.290
Well there.

02:01.310 --> 02:09.860
So they go if the my quantity that is our first argument is less than the price break which is a thousand

02:10.340 --> 02:13.110
then discount calc.

02:14.450 --> 02:20.670
And you'll remember that this has to be the same as they said the discount calc is going to equal nothing.

02:20.840 --> 02:21.230
Okay.

02:21.260 --> 02:27.420
So now let's let's let's just test that so if we said 100 men a pound each.

02:27.480 --> 02:28.910
Let me just change the format.

02:28.970 --> 02:33.870
Woops let me just change the formatting on these currency formatting currency.

02:33.890 --> 02:34.570
Okay.

02:34.580 --> 02:37.520
Obviously whatever currency you're in is perfectly fine.

02:37.550 --> 02:42.020
So now and say What's it called it's called discount calcum say equals disc.

02:42.320 --> 02:43.010
No.

02:43.150 --> 02:48.990
The one thing to remember whatever case you use here is exactly the same case that AP is here.

02:49.010 --> 02:53.060
So if this said discount calc all in uppercase it would appear here.

02:53.180 --> 02:55.530
All in Upper a discount calc.

02:55.730 --> 02:59.380
My first argument is quantity Cummer.

02:59.480 --> 03:02.300
My second argument is price there.

03:02.480 --> 03:09.920
So when they hit that and hit enter zero they go because 100 is less than 1000 thousand.

03:09.920 --> 03:15.920
Our calculation is straightforward discount calculation equals absolutely nothing at all.

03:16.010 --> 03:19.870
So let's just copy that and let's add in our else.

03:19.910 --> 03:29.300
So discount calc equals it's going to be my quantity multiplied by my price.

03:29.460 --> 03:31.050
Woops.

03:31.130 --> 03:38.660
So this is what's going to happen if they breached the 1000 rules here and can be multiplied by discount

03:39.870 --> 03:43.700
and the discount here is 5 percent they've all capped the ISO.

03:43.810 --> 03:45.840
I have no typing mistakes.

03:46.130 --> 03:52.010
So let's try that so if we had 999 we still get no discount if we had one thousand.

03:52.040 --> 03:57.770
We still have no discount but if we have one thousand and one go we now get a 5 percent discount and

03:57.770 --> 04:01.150
the discount value is 50 pounds 50.

04:01.430 --> 04:01.990
Okay.

04:02.030 --> 04:06.320
So have fun with plane with eudi FS and I'll see you in the next section.
