Last active
June 26, 2018 03:59
-
-
Save rodloboz/c1db7c78f4b40747eef64efeba69e712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Hello" # string | |
# true # boolean | |
# false # boolean | |
# 3 # integer | |
# 3.14 # float | |
# ["Hello", 3, 3.14, true] # array | |
# (1..10) # range | |
# # String interpolation | |
# name = "Rui" | |
# "Hello, #{name}" | |
# methods | |
def say_hello(name) | |
puts "Hello, #{name.capitalize}." | |
end | |
name2 = "Mike" | |
# puts "Hello, John" | |
# puts "Hello, Ringo" | |
# puts "Hello, Tango" | |
# puts "Hello, Cash" | |
# prints Hello + a name | |
# john = "john" | |
say_hello("john") | |
say_hello("tango") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
def max(x, y) | |
if x > y | |
return x | |
elsif x < y | |
y | |
else | |
false | |
end | |
"hello" | |
end | |
first_number = 1 | |
second_number = 2 | |
#. x , y | |
puts max(9, second_number) | |
def tomorrow | |
tomorrow_date = Date.today + 1 | |
# format time | |
tomorrow_date.strftime("%d %B %Y") | |
end | |
puts tomorrow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment