Skip to content

Latest commit

 

History

History
32 lines (30 loc) · 1.54 KB

syntax_guide.md

File metadata and controls

32 lines (30 loc) · 1.54 KB

Ruby syntax

In ruby, there are many parts of the syntax that are not easily searchable on google. This provides all the names of those things

Symbol Name Possible Uses
# Comment Anything written after this is ignored by the computer
| Pipe 1) Boolean OR (`
& Ampersand 1) Boolean AND (&&), 2) Bitwise Operator
= Equals Variable assignment
== Double Equals Boolean comparison
!= Not Equals Boolean Comparison
>= Greater than or Equals Boolean Comparison
=> Hash Rocket 1) Denotes return values, 2) Assignment in hashes
<< Shovel Add to an array
: Colon 1) Symbol creation, 2) Hash assignment
:: Namespace Modules and Classes
; Semicolon Terminates a line
% Modulo Divides two numbers and gets the remainder
! Not operator Flips true and false in booleans
nil Represents nothingness 1) Hashes, 2) Control Flow, 3)
[] Square Brackets 1) Arrays, 2) Hash keys
{} Curly Braces 1) Hashes, 2) Blocks
() Parentheses 1) Precedence grouping, 2) Function definition and use
#{} String Interpolation 1) Strings
\ Backslash 1) String escaping,
/ Forward Slash 1) Division (math)
end Closing end 1) Functions, 2) Loops, 3) Blocks
? Question mark 1) Function names, 2) Ternary conditionals
! Bang 1) Function names
* Splat 1) Multiplication, 2) Argument expansion
@ At 1) Instance Variables