Skip to content

Instantly share code, notes, and snippets.

##Dependencies
#If you want to require library c when you install it it requires library d;
#Things you are depending on depend on other things;
##PACKAGE MANAGER SOLVES ALL OF THIS!
gem install package name #Will work out where to store it on your system, it will work out all the dependencies and go and download them;
#Some gems are very complicated such as ImageMagick, it depends on software that is written on your computer and not in ruby;
require 'sinatra' #only works if we have installed sinatra on our machine;

Robot Name

When robots come off the factory floor, they have no name.

The first time you boot them up, a random name is generated, such as RX837 or BC811.

In other words, if I say:

puts "Robot 1: "
print "enter loan amount: "
loan = gets.chomp.to_i
print "Enter length of time in months: "
time = gets.chomp.to_i
print "Enter interest rate: "
rate = gets.chomp.to_f/100
i = (1+rate/12)**(12/12)-1
annuity = (1-(1/(1+i))**time)/i

Current as at 25-Feb-2014

#Ruby Notes ###Terminology Literals = values e.g. 1 or "Simon"
Variables = a place to store values
Operator = + - * / % = Parameter = inputs for variables
Fix_num = an integer