Today's Code Another version of Today's Code
The goal of this breakout is to introduce OOP (Object Oriented Programming) in Ruby.
We will attempt to model a real life pokemon battle which discusses the following concepts:
Today's Code Another version of Today's Code
The goal of this breakout is to introduce OOP (Object Oriented Programming) in Ruby.
We will attempt to model a real life pokemon battle which discusses the following concepts:
| puts 'Welcome to Nima\'s Arena' | |
| # - Pokemon | |
| # - attacks | |
| # - health | |
| # - type | |
| # - weakness | |
| # - name (pokemon name) | |
| # - nick name |
| dog = 'Spot' | |
| puts dog | |
| p dog | |
| print dog | |
| print dog | |
| print dog | |
| print dog | |
| p "There are many ways to print things! What are the differences?" |
| class Trainer | |
| attr_reader :name | |
| def initialize name | |
| @name = name | |
| end | |
| end | |
| # a description of what the heck a pokemon is... | |
| class Pokemon |
| dog = 'Spot' | |
| puts dog | |
| p dog | |
| print dog | |
| print dog | |
| print dog | |
| print dog | |
| p "There are many ways to print things! What are the differences?" |
| // Question 1 | |
| // Nothing happens | |
| // Question 2 | |
| let bestFriend = 'Tyson' |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Page Title</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link rel="stylesheet" type="text/css" media="screen" href="main.css"> | |
| </head> | |
| <body> | |
| <div> | |
| </div> |
| import React, {Component} from 'react'; | |
| const Song = (props) => { | |
| return ( | |
| <li>{props.song}</li> | |
| ) | |
| } | |
| class SongsList extends Component { |
| import React, {Component} from 'react'; | |
| class VideoThumb extends Component { | |
| render() { | |
| console.log('HELLO I AM PROPS', this.props) | |
| return ( | |
| <div> | |
| <h1>{this.props.name}</h1> | |
| <img src={`https://api.adorable.io/avatars/50/${this.props.name}.png`} /> | |
| </div> |
| // little snippets of code | |
| // interpret the code ourselves | |
| // Snippet 1 -- nothing happens, we think | |
| // Snippet 2 -- hey there | |
| console.log('hey there') |