Skip to content

Instantly share code, notes, and snippets.

@caioertai
Last active April 13, 2022 06:06
Show Gist options
  • Save caioertai/c760e0ac53343a633136294daad7bcc2 to your computer and use it in GitHub Desktop.
Save caioertai/c760e0ac53343a633136294daad7bcc2 to your computer and use it in GitHub Desktop.
# RECAP
# On representation:
# 1. The name of a dog.
# 2. The age of a person.
# 3. The height of a person in meters.
# 4. Affirmation of negation.
# 5. ???
# On retrieving and assigning values:
# ???
# Programmer's Spouse:
# - Go to the store and get a loaf of bread. If they have eggs, get a dozen.
# Programmer returns with 13 loaves of bread.
# Live-code: Interactive voting age program
# Using inline conditionals
# Examples of truthy vs falsy
# Live-code: Let's flip coins
# Can we make it shorter?
# Live-code: Morning? Afternoon? Evening? Lunch time!
hour = gets.chomp.to_i
# Say to which fraction of the day the hour belongs.
# Live-code: Old School UI
# User should be able to choose either:
# - read
# - write
# - exit
# Live-code: Opening hours
# Print the state of a shop that opens at 8, closes at 19, but is closed at noon
hour = gets.chomp.to_i
# Live-code: Find the right random number
number_to_find = rand(1..5)
# Give user the option to guess the number
# Print the result of the guess.
# Declare an array of the Dungeons and Dragons Cartoon characters
characters = ["Bob", "Sheila", "Uni"]
p characters
# Print all characters names:
# Using for
# Using while
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment