Giter Club home page Giter Club logo

my_ruby_course's Introduction

I'm doing this course for fun since I'm a Ruby enthusiastic! This material is under construction.

DaniSacra Ruby Course

Table of Contents

Basics

  • Everything is an object

    p 1.methods
    p 2.between? 1,3
    p 2.even?
    p 1+2
    p 1.+(2)
    p 3 == 3

Variables

  • Types

    name = 'Daniel'   # Strings
    age = 42          # Integer
    weight = 89.9     # Float
    is_tall = true    # Boolean
  • Calculations

    puts 2 * 3        # Basic Arithmetic: +, -, /, *
    puts 2**3         # Expoent
    puts 10 % 3       # Modulus
    puts 1 + 2 * 3    # Order of operation
    puts 10 / 3       # Float
  • Iteration with +=, -=, /=, *=

    num = 1
    num += 10
  • Setting values

    sum = 1 + 2
    a, b = 1, 2
    name = 'Daniel'
    res = 1 > 2 ? true : false
    c, d, e = [1, 2, 3]

Strings

  • Basics

    greeting = 'Hello Ruby'
    
    puts greeting.size
    puts greeting[0]
    puts greeting.include? 'Ruby'
    puts greeting[1, 3]
    puts greeting[-1, -4]
  • Interpolation

    a = 1
    b = 4
    puts "The number #{a} is less than #{b}"
  • Search in strings

    "[Luke:] I can’t believe it. [Yoda:] That is why you fail.".include? 'Yoda'
    "Ruby is a beautiful language".start_with? 'Ruby'
    "I can't work with any other language but Ruby".end_with? 'Ruby'
    "I am a Rubyist".index 'R'
  • Replace

    "I should look into your problem when I get time".sub('I','We')
    "I should look into your problem when I get time".gsub('I','We')
    'RubyIsGreat'.gsub(/[aeiou]/,'1')
    'Ruby Is Pretty Brilliant'.gsub /[A-Z]/, '0'

Loops

Arrays

Hashes

Classes

Methods

my_ruby_course's People

Contributors

danisacra avatar

Watchers

James Cloos 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.