07-01-2022 late

341 words 2 minutes

Don't know about Bud and deadlines - somewhat concerned

i think the verifile admin is done to the best of my ability

i want to make a little progress before i sleep

consider what is put into the language by the creator - in this case, Matz

Matz considered the glyphs '1', '2', '3', etc, and placed them within the Ruby language

because math is native to the Ruby language, Ruby can do operations such as '1 + 2 = 3'

like in C, the language from which Ruby is constructed, constants are defined as CAPS_VARIABLES

remember that the modulo operator divides a variable by the operand, and returns the remainder

MASTERY QUIZ 3

Ruby interacts with the outside world

remember the dot syntax

when Ruby looks at something like 1 + 2, it is actually saying 1.+(2), which returns 3!

  • where can I find this in the Ruby source code???

Some methods however, do not need arguments

rememeber that when methods are used, they are "called"

Other useful methods include ( rand, puts, p, print, pp )

rand returns a float between 0 and 1

however if rand is passed an interger rand(integer) the return value will lie between 0 and (integer.-(1)) :)

Dividing integers

Integers don't change types (auto type casting?) when they are divided - they cant be rounded down to become floats

remember to use floats whilst dividing

integers can be converted to floats with the .to_f conversion method

Objects have a limited number of methods that can be called upon them

According to this, the finite set of methods that can be called upon an object are an interface

All ruby objects implicitly contain a method called methods, which will list the available methods for the object

Object interfaces are also detailed in the ruby documentation

Chaining

rememeber that methods can be chained together object.method1(arg1).method2(arg2).method3(arg3, arg4)

object will first be changed by method1. if object.method1(arg1) is successful then method2(arg2) will be called upon the return value of the modified object variable

mastery 4, request quiz