General Flashcards
Name all the 19 Parts of Speech of the Ruby language.
Variables, Global Variables, Instance Variables, Class Variables, Constants, Symbols, Methods, Class Methods, Method Arguments, Numbers, Strings, Blocks, Block Arguments, Ranges, Arrays, Hashes, Regular Expressions, Operators, Keywords,
Any plain, lowercase word.
Variable
Variables can consist of what types of characters?
letters, digits and underscores
What are these examples of? x, y, banana2, phone_a_quail
Variables
Two types of Numbers
Integers and Floats
A series of digits which can start with a plus of minus sign
Integer
What are these examples of? 1, 23, -1000, 12_000
Integer
Numbers with a decimal point or scientific notation
Float
What are these examples of? 3.14, -8,08, 12.043e-04
Float
Any sort of characters surrounded by double or single quotes
String
What are these examples of? “sealab”, ‘2021’, “These cartoons are hilarious”
String
Look like variables, but start with a colon
Symbol
What are these examples of? :a, :b, :ponce_de_leon
Symbol
Looks like variables, but capitalized
Constants
What are these examples of? Time, Array, Bunny_Lake_Is_Missing, EmpireStateBuilding
Constant
Verbs attached to variables and constants by a dot
Method
Provides additional information to a Method to perform more specific actions
Method Argument
What are these examples of? front_door. open
variable.method
What are these examples of? front_door.paint( 3, :red)
variable.method.method argument
Usually attached after a variable and/or constant with a double colon
Class Method
What are these examples of? Door::new( :oak)
Constant::class method (method argument)
Variables that start with a dollar sign
Global Variable
What are these examples of? $1, $x, $chunky
Global Variable
Variables that begin with @ symbol often used to define the attributes of something
Instance Variable
What are these examples of? @x, @y,
Instance Variable
Variables that begin with a double @@ used to define attributes to many related objects
Class Variable
What are these examples of? @@x, @@y
Class Variable
Characters surrounded by curly braces to group a set of instructions together so that they can be passed around
Block
A set of variables surrounded by pipe characters and separated by commas
Block Argument
Two values surrounded by parantheses and separated by an ellipsis…two or three dots
Range
What are these examples of? (1..3)
Range
A list surrounded by square brackets and separated by commas
Array