У нас вы можете посмотреть бесплатно What are Return Methods in C#? Mastering C#: Efficiently Working with Return Methods или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
#coding #codingbootcamp #softwaredeveloper Enter to win free tuition! Enter below! https://startuphakk.com/start-now/?v=... GitHub Repo: https://github.com/slthomason/Startup... A return method on the other hand can run the required code, but in the end will return a value that can be stored in a variable. String Variable private string _name; We create a private string variable called _name. Return Method int GetCharacters(string name) { return name.Length; } We are going to skip over the start method, because in order to build a structure, we need to understand the blueprint. Let’s go word for word and describe what is going on with this method. 1. int — returns an integer value once the method is ran 2. GetCharacters — method name 3. (string name) — sets a parameter that the method will accept When you use a return method, you must also include the keyword return to tell the method when and what to return. Within our method, on line 22, we tell our method to return the length of the string that the method took in called name. Start Method private void Start() { _name = "Jordan"; int characterCount = GetCharacters(_name); Debug.Log("Character Count: " + characterCount); } All the magic of this simple program happens within our start method. Let’s decode our code line by line to figure out what is happening… 1. Instantiates our string variable to have our _name variable hold the value “Jordan” 2. There are actually 3 things that are happening in this simple line of code… a) Creates an integer variable called characterCount b) Instantiates our characterCount variable and has it hold the integer value our GetCharacterCount method returns. c) Calls our GetCharacterCount method and passes our string variable _name to it. 4. Debug.Log("Character count: " + characterCount); This line simply runs a log that states our character count is the value our return method gave which is stored in our variable characterCount. After running our program we get a log comment stating our Character Count is 6. Which “Jordan” has 6 characters.