Symbols & Methods Flashcards
To learn the basics of Ruby symbols and function, so that I may read code (41 cards)
#
octothrope - used to make a comment
{$0}
From command line, the name of the script you are running
{variable}
used for interpolation of a variable / to include your variable that doesn’t have information in it yet
$
attaches a variable from the command line
%
Modulo that returns the remainder in division
%d
represents a digit in a text string
%s
represents a string of text in a test string
( )
used to encapsulate arguments
*
multiplication
+
addition
-
subtraction
/
division
<
less than
«TEXT TEXT
to start and end a chunk of code that will not be read by ruby
<=
less than or equal to
>
greater than
> =
greater than or equal to
ARGV
argument value, holds arguments held on the cmd line
File
used as a method to define and enact file options
File.close()
closes a file
File.exists?
check to see if a file exists or not
File.open()
opens a file
File.open(filename, ‘w’)
Specifically opens a file for writing
File.read()
reads the contents of a file