1 00:00:00,630 --> 00:00:04,650 Hello and welcome to this lecture in this lecture. 2 00:00:04,830 --> 00:00:12,450 I'm going to go through some guidelines that you can use in naming your variables. 3 00:00:12,450 --> 00:00:25,980 The first is a variable name should contain at least one alphabetical character a variable name can 4 00:00:25,980 --> 00:00:28,690 not start with a number. 5 00:00:28,890 --> 00:00:35,010 You can't name a variable name say One two three four or four or five and then a letter. 6 00:00:35,010 --> 00:00:42,180 You can't do that the next a variable name should not or must not contain spaces. 7 00:00:42,180 --> 00:00:50,820 So if you have variable names that are made up of one or more words you cannot leave spaces between 8 00:00:50,820 --> 00:00:59,280 the words when naming variables you cannot use reserved key words. 9 00:00:59,310 --> 00:01:05,700 So there are some key words that are used by the C sharp programming language and they are also used 10 00:01:05,700 --> 00:01:07,200 by the C sharp compiler. 11 00:01:07,200 --> 00:01:11,630 You cannot use those as variable names. 12 00:01:11,670 --> 00:01:17,870 I will I will show you a list of some of the key words shortly. 13 00:01:18,960 --> 00:01:30,480 Your variable names should not contain known alphanumeric characters other than a dash and an underscore. 14 00:01:30,960 --> 00:01:33,300 So you can use non alphanumeric. 15 00:01:33,510 --> 00:01:38,880 However you can use a dash and an on the skull. 16 00:01:38,970 --> 00:01:49,230 So this is some information from the Microsoft MLC insight and is relating to the C sharp keywords if 17 00:01:49,230 --> 00:01:50,980 here on the first line here it tells you. 18 00:01:50,980 --> 00:02:02,160 Key words are predefined they are predefined they are reserved identifiers that have special meaning 19 00:02:02,520 --> 00:02:12,090 to the compiler so you can't use them they cannot be used as an identifier in your program on less they 20 00:02:12,090 --> 00:02:25,240 include the act as a prefix for example at if if a valid identifier but if not because if it's a keyword. 21 00:02:25,680 --> 00:02:29,280 So these are some guidelines you can go through it at your own convenience. 22 00:02:29,280 --> 00:02:31,040 So that's a link there. 23 00:02:31,230 --> 00:02:35,840 Oh you can type in C sharp keywords in your search engine. 24 00:02:35,910 --> 00:02:41,730 It should give you some more information so let me just browse through so you can see I'm telling you 25 00:02:41,730 --> 00:02:48,710 here that the first table this first table here is a list of key words that are reserved. 26 00:02:48,750 --> 00:02:55,460 Identify identify mean you use it to identify something the identifiers in any part of the program. 27 00:02:55,470 --> 00:02:58,960 So this is the first tables so these words you can't use. 28 00:02:59,010 --> 00:03:09,690 You can't call your variable for example abstract has Baz bool char class you know if you go to for 29 00:03:09,690 --> 00:03:18,650 each n and so so you can't if you try the your visual studio will complain you will have a red squiggly 30 00:03:18,660 --> 00:03:25,430 lines on the net and you will not go for a home bite so you can use it won't let you use it anyway. 31 00:03:25,500 --> 00:03:30,000 So these are they just go through them so you can't use any of these or when you tried to create a variable 32 00:03:30,000 --> 00:03:36,130 name you get the red squiggly lines in your features do you just know that is not happy. 33 00:03:36,150 --> 00:03:44,250 So again this is the kind textural keywords says contextual quick keyword is used to provide a specific 34 00:03:44,250 --> 00:03:52,260 meaning in the code but it is not a reserve key word in C sharp some context shows key words such as 35 00:03:52,260 --> 00:03:57,750 partial and where have special meaning in two or more contexts. 36 00:03:57,810 --> 00:04:01,670 So the key one really is this table here you need to focus on. 37 00:04:02,140 --> 00:04:02,960 Okay. 38 00:04:03,000 --> 00:04:04,260 All right let's go over. 39 00:04:04,260 --> 00:04:06,090 Let me open up the visual studio. 40 00:04:06,090 --> 00:04:12,120 Let's have a look and just try and see if we can use a variable name that is not allowed. 41 00:04:13,710 --> 00:04:14,070 All right. 42 00:04:14,070 --> 00:04:21,750 So this is some of the code we've used before in Kuwait in our first app say if I come here way we've 43 00:04:21,760 --> 00:04:30,530 got I just tap down and say I wanted to create in another variable and I wanted to be a string. 44 00:04:30,810 --> 00:04:40,320 So I type a string followed by the word for you can see the squiggly line because that is the reserve 45 00:04:40,320 --> 00:04:40,610 word. 46 00:04:40,610 --> 00:04:41,910 You notice it's turned blue. 47 00:04:42,400 --> 00:04:42,710 OK. 48 00:04:42,750 --> 00:04:49,290 So most of these words in blue you can't use them because they're all reserved in notices turn blue. 49 00:04:49,290 --> 00:04:52,350 That means I can't use it. 50 00:04:52,380 --> 00:04:52,770 OK. 51 00:04:52,790 --> 00:04:58,050 So let me try something else you know I know I said you cannot use a number. 52 00:04:58,050 --> 00:04:59,550 If I try one 53 00:05:02,640 --> 00:05:03,180 name. 54 00:05:04,940 --> 00:05:05,430 Yeah. 55 00:05:05,530 --> 00:05:08,160 No this is not happy with that because I can't. 56 00:05:08,160 --> 00:05:12,450 You can start a variable name with a number. 57 00:05:12,450 --> 00:05:15,120 OK so that's just some guidelines. 58 00:05:15,120 --> 00:05:19,580 So the visual studio will also give you a guide as to where you're going wrong. 59 00:05:19,600 --> 00:05:26,190 If you're trying to create a variable with a name that is not allowed you get those squiggly lines and 60 00:05:26,190 --> 00:05:27,960 that should give you a clue. 61 00:05:28,410 --> 00:05:35,310 So that is it for this lecture in guidelines to how you name your variables. 62 00:05:35,310 --> 00:05:36,990 I hope he has been helpful. 63 00:05:37,020 --> 00:05:37,710 Thank you. 64 00:05:37,860 --> 00:05:38,600 Bye for now.