1const e=` 2 3#| Tutorial | Code Readability | Beginner | 4 5> **NOTE:** This will be going over naming conventions, organized diagrams, and reusable code. All of these will be defined in the Tutorial. Vocabulary for highlighted words will be at the bottom of the Tutorial. 6 7------ 8 9> **Learning Target:** I can correctly organize my code in a way that is understandable and readable to others. 10 11 12 13##Why should I make my Code Readable? 14 15Code readablility can help readers understand what your code does faster. If you are working in a studio with multiple **scripters** or developers. These people may want to modify or understand how the code works. If they catch a bug or want to add a new feature it would be really helpful if they could understand the code. 16 17**Your code should:** 18 19- Produce and expected result 20- Be easily readable and understandable by yourself and others 21 22Obviously, creating readable code takes more effort than quickly written code. 23 24 25##Naming Conventions 26 27**What is a naming Convention?** 28 29A naming convention is a rule for how you name various files, folder, objects, variables. functions, etc. A naming convention can help make your code for understandable and discoverable when used **consistently**. 30 31**Common Naming Conventions** 32 33- Camel case (ex: randomVariable) 34- Pascal case (ex: RandomVariable) 35- Snake case (ex: random_variable) 36 37**Pascal Case** 38 39Pascal case is basically the same thing as Camel case except every word begins with a capital letter. 40 41**Snake Case** 42 43Snake case is normally used in C-style languages. It seperates the words with and "_" and normally is used to **denote** a constant. 44 45**Applying the naming conventions together** 46 47Some developers also use two different naming conventions together. Functions will use Pascal case and variables will use Camel case. 48 49**Example** 50\`\`\`Lua 51local exampleString = "Interesting String"\r 52\r 53function RemoveSpaces(stringToSplit:string)\r 54 return stringToSplit:gsub(" ","")\r 55end 56\`\`\` 57 58 59##Code Organization 60 61Organizing your code with notes can help readers understands what section of your code does what. You could make a section of your script for variables, and another for functions. You could even list different types of variables separately. Putting an overview at the top of your code to explain the purpose of the entire script can be helpful as well. 62 63You can separate different types of variables and functions with notes. you can even make it fancy with little arrow shapes. 64 65If you have a time value, you could put a note next to it that says if it is in seconds, minute, hours, etc. 66 67**Example** 68\`\`\`Lua 69--[[\r 70CREATOR: ExampleUsername\r 71\r 72This code is used to demonstrate how users can, put notes on their code, make it\r 73more readable to users, create an overview, and organize their code.\r 74]]--\r 75\r 76--[[ |> Services <| ]]--\r 77\r 78local replicatedStorage = game:GetService("ReplicatedStorage")\r 79local httpService = game:GetService("HttpService")\r 80local dataStoreService = game:GetService("DataStoreService")\r 81\r 82--[[ |> Objects <| ]]--\r 83\r 84local spawnLocation = workspace.SpawnLocation\r 85\r 86--[[ |> Values <| ]]--\r 87\r 88local debounce = false\r 89local totalMatchTime = 100 -- In seconds\r 90\r 91--[[ |> Setup Functions <| ]]--\r 92\r 93function SetupGame(stuff here)\r 94 stuff here\r 95end\r 96\r 97\r 98--[[ |> Match Functions <| ]]--\r 99\r 100function RunGame(stuff here)\r 101 stuff here\r 102end 103\`\`\` 104 105 106#Vocabulary 107 108> **scripter (computing)** - A person who writes or users a programming language. A programmer. 109 110> **consistent** - Acting or done the same way over time. 111> Example, "The parents are being consistent and firm in their reactions." 112 113> **denote (computing)** - Stand as a name or a symbol for. 114> Example, "The level of output per film, denote by X." 115 116 117 118> **Learning Target:** I can correctly organize my code in a way that is understandable and readable to others. 119 120 121 122--- 123 124 125 126 127 128`;export{e as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.