Coder Social home page Coder Social logo

advanced-hashes-hashketball-nyc-web-010620's Introduction

Hasketball Review

Introductory Notes

How to participate in lecture

  • Don’t wait for the answer
    • make a hypothesis based on the context and knowledge you have so far.
    • even if you don't plan on raising your hand, form a hypothesis in your head.
  • Don’t be afraid to give the wrong answer.
  • If you get tired or sleepy, do whatever it takes to stay awake.
    • jumping jacks
    • stand in the back
    • I don't care as long as it is not distracting others.

How to make the most of the labs

  • RSPEC and TDD --f-f
  • please don't just keep guessing till all the lights turn green.

SWBATS

  • Identify common data types in Ruby.
  • Explain what these iterators do:
    • #each
    • #select
    • #map
    • #find
  • Create Methods
    • basically allow us to organize our procedures

Data Types

  • Strings - some data representing text

    • to_i
    • to_f
  • Integers - some data represting numbers

  • Boolean - true or false

    • !!
  • Arrays

    • indices
    • how to access something.
  • Hash - like a dictionary, where key is the word, value is the definition.

    • keys
    • values
    • symbols

Enumerable Methods in ruby

  • each
  • map - put whatever the block returns in a new array
  • find - return the first thing that returns true
  • select - returns all the things that returned true

Methods in ruby

  • Implicit return
  • Explicit return
  • binding.pry
def game_hash
    # returns a big hash with relavant data
end

def all_players
    game_hash[:home][:players].concat(game_hash[:home][:players])
end

def find_player(player_name)
    all_players.find { |player| player[:player_name] == player_name }
end

def num_points_scored(player_name)
    find_player(player_name)[:points]
end

We didn't have to make so many different methods, but now the code is more readable, updatable and modular because we did.

number_points_scored

  • break large problems into small problems
  • get quick feedback loop (code something, try it out)

advanced-hashes-hashketball-nyc-web-010620's People

Contributors

annjohn avatar antoinfive avatar aviflombaum avatar benjagross avatar deniznida avatar donnadieu avatar eaud avatar fislabstest avatar fs-lms-test-bot avatar ipc103 avatar irmiller22 avatar kthffmn avatar loganhasson avatar markedwardmurray avatar matthewkrey avatar maxwellbenton avatar sarogers avatar sbal13 avatar sim1hill avatar sophiedebenedetto avatar thejasonfile avatar thuyanduong-flatiron avatar victhevenot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.