5.C.1.B: Building Learner Scripting Skills

  • Scripts as Behavior Components
    • Link: scripts-as-behaviour-components (3:27)
    • Notes:
      • Components as behaviors can be applied to objects
      • You’re creating new features through script/adding values/making it custom
      • Scripts can be created in the project panel
      • Think of scripts as self-created components
  • Variables and Functions
    • Link: variables-and-functions (5:52)
    • Notes:
      • Variables: boxes that contain information, you need a different box for different information
      • First part= declaration, second part= information
      • Function/Method: returns information
        • give it a name so it returns a certain type of information
        • function can have parameters
  • Conventions and Syntax
    • Link: conventions-and-syntax (4:10)
    • Notes:
      • Coding syntax: the structure of the language
      • Some conventions are essential to learning read/write code
        • dot operator
          • creates a sort of hierarchy?
        • semicodon
        • indenting
          • not necessary, but reads more easily/shows functional structure
        • comments
          • leave yourself a note
  • C# vs JS syntax
    • Link: c-sharp-vs-javascript-syntax (1:54)
    • Notes:
      • declaration is hidden in JS
      • C# declaration is included right at the beginning of a line
      • default access motivators (?)
      • Javascript better for web development, C# better for things like app-building
  • IF Statements
    • Link: if-statements (1:27)
    • Notes:
      • if-else statement
        • make else statement conditional by adding another if statement
  • Loops
    • Link: loops (5:33)
    • Notes:
      • loops: way to repeat lines of code (iterating)
        • while loop
          • keyword while, parentheses conditional
        • dowhile loop
          • shouldcontinue=false, dowhile loop, keyword do w/ open and close braces, after body -while w/ conditional
        • Forloop
          • Similar to while, different syntax
          • keyword four, parentheses, three specific sections
            • first optional
            • conditional
            • optional
          • semicolon and not comma that separates sections
        • Foreach Loop
          • collections
          • cannot modify elements using this loop
  • Classes
    • Link: classes (6:00)
    • Notes:
      • each script contains a definition for a class
      • metaphor: variables = boxes+ functions = machines, classes are the factories that the boxes and machines are in
      • class is a container for variables and functions, nice way to group things that go together
      • classes should be dedicated to one task
      • name of constructor is always the name of the class
      • can have multiple constructors per class

Leave a Reply

Your email address will not be published. Required fields are marked *