aA

[Week 1] Part 1: Ruby Foundations

silveryen 2022. 9. 12. 06:48

 

  • ●  Primitive Data Types
    • ○  Booleans
    • ○  Integers
    • ○  Floats # 소수점 을 포함하는 숫자 
    • ○  String Manipulation # string 삽입 #{} 사용, 인덱스[]를 사용하여 extract substring ..etc
    • ○  Debugging
      • Reading the stack trace
      • Using debuggers correctly
      • Intro to scientific method
  • ●  Methods, Iteration, Input/Output, Code Style
    • ○  ArrayDRY # Don't Repeat Yourself
    • ○  Blocks, Procs, and Lambdas
    • # Blocks do / end 로 끝나거나, {} 으로 묶인 것. 다양한 변수를 가질 수 있다. 
    • # Lambdas is a way to define a block & its parameters with some special syntax. (첫번째 코드블락 참고)
    • ○  Descriptive variable naming
    • ○  Scope
say_something = -> { puts "This is a lambda" }
say_something.call

# "This is a lambda"

times_two = ->(x) { x * 2 }
times_two.call(10)
# 20

참고: https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/