WEBVTT 00:00:06.680 --> 00:00:10.460 In this video you get to learn BHB variables. 00:00:10.560 --> 00:00:13.140 Let's go to our fine FCP. 00:00:13.140 --> 00:00:17.910 First let's back up all our files to our PH's people there on our computer. 00:00:17.910 --> 00:00:24.670 So it's going to open this fall and we're going to let's these files by holding control. 00:00:24.690 --> 00:00:31.050 So if you click on the left arrow you'll see that are going to be copied into the BHB fold. 00:00:31.160 --> 00:00:31.630 OK. 00:00:31.890 --> 00:00:35.610 Now an increase in your file variables. 00:00:35.710 --> 00:00:43.260 Those BHB they are going to open this file using brackets. 00:00:44.370 --> 00:00:54.100 And now we're going to do we are going to use in Ishmail templates and then we're going to inject a 00:00:54.100 --> 00:00:58.100 PSP code into it's going to use a bootstrap template. 00:00:58.110 --> 00:01:05.630 So if you can go to your bootstrap folder and go to the last file and just copy the content from the 00:01:07.410 --> 00:01:11.130 cube if you go back to the variables file just paste the contents. 00:01:11.400 --> 00:01:17.450 OK so now we've got the bootstrap templates which is going to get rid of the contents. 00:01:17.530 --> 00:01:21.380 OK so we don't need the last script. 00:01:21.660 --> 00:01:27.810 And also if you go the in the in the body elements we're going to keep the container div but he's going 00:01:27.810 --> 00:01:32.390 to delete the contents of the div. 00:01:34.250 --> 00:01:35.050 OK. 00:01:35.100 --> 00:01:43.450 And also we don't need the attributes of the body and the content of the style elements. 00:01:43.460 --> 00:01:50.570 OK let's change the title to variables. 00:01:50.670 --> 00:01:51.810 Let's do some formatting 00:01:57.120 --> 00:02:09.710 . 00:02:16.980 --> 00:02:21.450 OK so first I'm going to create a heading. 00:02:21.690 --> 00:02:24.520 OK I'm going to call. 00:02:24.540 --> 00:02:30.350 I'm going to write variables in the heading and let style our heading. 00:02:30.560 --> 00:02:30.860 OK 00:02:34.050 --> 00:02:40.240 let's give it a color purple. 00:02:42.240 --> 00:02:47.070 So if you go to the browser and just go back to the BHB folder if you refresh. 00:02:47.070 --> 00:02:48.770 You can see the variables file. 00:02:48.780 --> 00:02:49.770 Just click on it. 00:02:49.900 --> 00:02:55.090 And now you can see our Web page with the variables heading. 00:02:55.740 --> 00:03:03.050 OK so now we're going to create a paragraph and then inside our paragraph we're going to write some 00:03:03.050 --> 00:03:03.980 BHP code. 00:03:04.140 --> 00:03:08.560 So we're going to have the BHB tag. 00:03:09.770 --> 00:03:10.160 OK. 00:03:10.210 --> 00:03:13.400 Now let's create our first variable. 00:03:13.680 --> 00:03:19.660 So as we have seen in javascript's there are certain rules that we need to follow. 00:03:20.370 --> 00:03:31.080 The syntax variables so the variables need to follow some slightly different slightly different syntax 00:03:31.110 --> 00:03:32.520 than the javascript's. 00:03:32.520 --> 00:03:38.060 So the first rule is our variable need needs to starts with a dollar sign. 00:03:38.310 --> 00:03:39.000 OK. 00:03:39.000 --> 00:03:45.090 And then we can have the name of the variable so it's have a variable name that you can set to a string 00:03:45.100 --> 00:03:45.410 . 00:03:45.750 --> 00:03:50.080 John. 00:03:50.100 --> 00:03:51.150 OK. 00:03:51.870 --> 00:04:01.020 So the Bible says with a dollar sign and then the name of the variable needs to start with a letter 00:04:01.400 --> 00:04:02.530 or an and this. 00:04:03.030 --> 00:04:06.600 OK letter and this call we can solve with a number. 00:04:06.630 --> 00:04:08.480 For example. 00:04:08.630 --> 00:04:12.600 And also obviously we can't have any space inside the variable so. 00:04:13.180 --> 00:04:17.270 So that's our first variable is create another one. 00:04:18.180 --> 00:04:23.000 So this is going to be age and let's set it to a number three. 00:04:23.490 --> 00:04:24.360 OK. 00:04:24.840 --> 00:04:26.980 Now let's use these variables. 00:04:27.030 --> 00:04:30.670 So are you going to use a function echo. 00:04:30.690 --> 00:04:41.280 So if you click on the function name and then do control K since we saw some extensions we can see some 00:04:41.280 --> 00:04:43.100 details about the function. 00:04:43.110 --> 00:04:47.250 So you can see that our function can output one or more strings. 00:04:47.430 --> 00:04:48.650 OK. 00:04:48.810 --> 00:04:51.020 And it's returning void. 00:04:51.030 --> 00:04:55.660 So it is what the function is returning. 00:04:56.650 --> 00:04:57.180 OK. 00:04:57.330 --> 00:05:02.220 And void means does the function is not returning anything. 00:05:02.320 --> 00:05:06.590 It's still I was using something on a screen by doesn't return anything. 00:05:06.960 --> 00:05:07.680 OK. 00:05:08.010 --> 00:05:09.210 So that's the name of the function. 00:05:09.240 --> 00:05:11.190 And these are the parameters of the function. 00:05:11.520 --> 00:05:12.930 OK. 00:05:13.020 --> 00:05:18.640 We don't have to use parentheses unless we have more than one barometer. 00:05:18.870 --> 00:05:21.590 OK. 00:05:22.170 --> 00:05:28.630 Anyway so let's use the echo function to write something on the screen. 00:05:29.130 --> 00:05:33.340 So I'm going to have a drink. 00:05:33.420 --> 00:05:34.840 My name is. 00:05:35.280 --> 00:05:36.300 OK. 00:05:36.330 --> 00:05:45.000 And then we're going to add we're going to concatenates this string with another string which is going 00:05:45.000 --> 00:05:47.130 to be our name variable. 00:05:47.340 --> 00:05:52.530 So we're going to use a dot sign followed by the variable name. 00:05:53.010 --> 00:05:53.710 OK. 00:05:53.940 --> 00:06:00.450 So in javascript's we use the plus sign but in BHB we use the dot sign to concatenate strings that are 00:06:00.450 --> 00:06:04.120 going to add another string. 00:06:05.870 --> 00:06:09.690 And then we're going to add another element here. 00:06:09.690 --> 00:06:16.070 So if you odd a number to a string then the number is going to be treated as a string. 00:06:16.340 --> 00:06:17.850 OK. 00:06:18.990 --> 00:06:21.670 And then another string. 00:06:23.820 --> 00:06:31.050 And then we need to finish our statements with the rebates to be called every refresh the page we can 00:06:31.050 --> 00:06:35.280 see the outputs are inside our program. 00:06:35.520 --> 00:06:37.500 OK. 00:06:37.970 --> 00:06:38.290 OK. 00:06:38.330 --> 00:06:42.800 So this page the yes. 00:06:43.190 --> 00:06:44.840 OK now let's create another paragraph 00:06:47.910 --> 00:06:49.810 Okay. 00:06:50.010 --> 00:06:55.180 Let's have a BHB tag again. 00:06:55.290 --> 00:07:00.770 So this time we're going to have a look at something difference. 00:07:00.820 --> 00:07:02.880 We're going to look at. 00:07:02.910 --> 00:07:06.360 Constance so in BHB we have two types of variables. 00:07:06.360 --> 00:07:11.150 We have the regular variables like the ones we have created there. 00:07:11.460 --> 00:07:23.550 And we have constants so constants they are identifiers of for simple values so they will identify a 00:07:23.610 --> 00:07:28.440 value that will not change in our screens. 00:07:28.500 --> 00:07:29.160 So what does it mean. 00:07:29.160 --> 00:07:35.970 So it means that once you have defined a constants in your scripts then after that's the value of Constans 00:07:36.240 --> 00:07:39.260 can not be changed in your script. 00:07:39.440 --> 00:07:39.870 Okay. 00:07:39.960 --> 00:07:47.040 And Constance they are used mainly for configuration settings like to define the name of a database 00:07:47.070 --> 00:07:49.960 or a password of a database for example. 00:07:50.580 --> 00:07:51.420 OK. 00:07:51.420 --> 00:08:02.600 And the syntax is pretty simple so we need to use the defined function to define a constant. 00:08:02.910 --> 00:08:05.550 So this function is going to say a couple of promises. 00:08:05.640 --> 00:08:11.800 So the first one is going to be the name of our constants inside double quotes. 00:08:11.820 --> 00:08:18.240 OK so for example if our name our cousins in the country are going to places inside the quotes here 00:08:18.710 --> 00:08:26.190 in the first promiser and the name of the Constans has got to be entirely uppercase and we don't have 00:08:26.230 --> 00:08:27.420 any dollar sign. 00:08:27.950 --> 00:08:31.230 So what's the difference with regular variables. 00:08:31.230 --> 00:08:31.700 OK. 00:08:31.770 --> 00:08:38.180 And then after that we can place the value of our constants. 00:08:38.430 --> 00:08:42.510 So please give it a go for a string. 00:08:43.050 --> 00:08:49.650 And we are going to use a string that England for example. 00:08:50.070 --> 00:08:50.550 OK. 00:08:50.550 --> 00:08:53.460 So here's how we can define a. 00:08:53.910 --> 00:08:57.910 Let's use this constant using the echo function. 00:08:58.080 --> 00:09:00.060 For example we can write 00:09:04.410 --> 00:09:06.060 light this nation 00:09:09.690 --> 00:09:10.510 and then it's odd 00:09:16.360 --> 00:09:18.140 or Constans. 00:09:18.500 --> 00:09:19.640 OK. 00:09:20.560 --> 00:09:23.750 You save the refresh. 00:09:23.760 --> 00:09:26.000 Now we can see the outputs the