SlideShare a Scribd company logo
Ruby
Code The Web
세상에서 가장 아름다운 프로그래밍 언어
2015.05.31
HTML + CSSHTML
웹 서비스의 기본 구성
Client Server
“나 페이지 보여줘”
“응 여기 있어”
Request
Response
Static Website (대학 동아리 소개 웹사이트)
Client Server
“나
페이지
보여줘”
“나 페이지 보여줘”
“나 페이지 보여줘”
“여기 똑같은 놈이야”
“그래 이 남자야”
“이 남자야”
Dynamic Website (페이스북, 트위터)
Client Server
“나
페이지
보여줘”
“나 페이지 보여줘”
“나 페이지 보여줘”
“넌 권한이 없어”
“넌 노란 남자”
“넌 파란 남자”
Code_The_Web_150531_Ruby_1
Code_The_Web_150531_Ruby_1
Object-Oriented
High-Level
Scripting Language
모든 것이 객체다(진짜로) 컴파일이 필요없음
마치 영어 문장처럼
겁나 쉽게 쓰이고 읽힙니다
Data Type 을 알아서 인식한다
my_age = 26
is_she_pretty = true
my_favorite_quote = “You are a beautiful monkey”
변수 이름을 이렇게 쓰자
my_age = 26
1. 소문자로 시작한다
2. 단어들은 _ (underscore)으로 구분한다 myAge (X)
My_age(X)
3. $, @등의 기호들로 시작하지 말자 $my_age (X)
연산 기호
25 + 2 = 27
5 - 3 = 2
3 * 4 = 12
5 / 4 = 1
2**3 = 8
10 % 7 = 3
덧셈
뺄셈
곱셈
나눗셈
지수
모듈 (나머지)
출력하기
puts “what is his name”
print “is he hot”
출력한 후 빈 줄을 하나 추가한다
화면에 그냥 출력한다
이름 (String)
나이 (Integer)
어머님 나이(Integer)
본인이 AB형인지 아닌지 (Boolean)
2. puts 를 이용해서 이름을 출력해주세요
3. print 를 이용해서 어머니 나이와
본인 나이를 곱한 값을 출력해주세요
4. puts 를 이용해서 AB형 유무를 출력해주세요
1. 위의 값들을 각각의 변수에 넣어서 입력해주세요
반복자(Iterators) - while loop
count = 1
while count <= 10
puts count
count += 1
end
반복자(Iterators) - for loop
for number in 1…10
puts “Hi”
end
반복자(Iterators) - for loop
animals = [“cats”, “dogs”, “monkeys”]
for num in 0..2
puts animals[num]
end
반복자(Iterators) - each loop
animals = [“cats”, “dogs”, “monkeys”]
animals.each do |x|
puts x
end
반복자(Iterators)
while, for, each 반복자들을 활용해서
1 ~ 10000 의 숫자를 합친 값을 출력하세요
Data 종류 - Symbol
표기 방식 :name
String 과 같다고 생각하면 이해하기 쉽다
주로 함수 이름, 키 이름, 변수등의 ID 로 사용된다
예) student[:grade]
Data 종류 - Array
x = Array.new
x << 10
x[1] = 99
y = ["Alice", 23, 7.3]
x[2] = y[1] + y[-1]
Data 종류 - Hash
person = Hash.new
person["last_name"] = "Rodriguez"
person[:first_name] = “Alice"
order = {"item" => "Corn Flakes", "weight" => 18}
order = {:item => "Corn Flakes", :weight => 18}
order = {item: "Corn Flakes", weight: 18}
It was the best of times, it was the worst of times, it was the age of wisdom,
it was the age of foolishness, it was the epoch of belief, it was the epoch of
incredulity, it was the season of Light, it was the season of Darkness, it was
the spring of hope, it was the winter of despair, we had everything before
us, we had nothing before us, we were all going direct to Heaven, we were
all going direct the other way.
위 글은 Charles Dickens 명작인
<두 도시 이야기>의 오프닝 문단입니다.
Hash를 이용하여 각 단어별로
문단에 등장하는 빈도수를 출력하세요
hint: String 의 split 함수 활요

More Related Content

PPT
Cdocumentsandsettingsjorgemisdocumentoscursosproyectoseadactualizacinproyecto...
PDF
Teorías de la Educación a Distancia
PDF
Teorias de la educacion a distancia.
PPT
Cinco teorías de Educación a Distancia
PPTX
Teorías Educación a Distancia
PDF
Teorías de la educación a distancia
PDF
Teorías de la Educación a Distancia
PPTX
0327.web&ruby&rails
Cdocumentsandsettingsjorgemisdocumentoscursosproyectoseadactualizacinproyecto...
Teorías de la Educación a Distancia
Teorias de la educacion a distancia.
Cinco teorías de Educación a Distancia
Teorías Educación a Distancia
Teorías de la educación a distancia
Teorías de la Educación a Distancia
0327.web&ruby&rails

Similar to Code_The_Web_150531_Ruby_1 (20)

PDF
RPG Maker와 Ruby로 코딩 시작하기 Day 3
PDF
Python 01
PPTX
Python
 
PPTX
Ruby 스터디
PPTX
Welcome to ruby!
PPT
Python3 brief summary
PPTX
C언어 종결 세미나 1
PPTX
빠르게 활용하는 파이썬3 스터디(ch1~4)
PDF
RPG Maker와 Ruby로 코딩 시작하기 Day 2
PDF
Perl Script Document
PDF
Javascript개발자의 눈으로 python 들여다보기
PDF
자구4번
PDF
1 Python기초 오리엔테이션
PPTX
Lua 문법
PDF
Perl Script
PPTX
Ruby - 6th (루비 6장 변수와 식)
PDF
20160126_python
PDF
3주차 language
PDF
Light Tutorial Python
PDF
자료구조04
RPG Maker와 Ruby로 코딩 시작하기 Day 3
Python 01
Python
 
Ruby 스터디
Welcome to ruby!
Python3 brief summary
C언어 종결 세미나 1
빠르게 활용하는 파이썬3 스터디(ch1~4)
RPG Maker와 Ruby로 코딩 시작하기 Day 2
Perl Script Document
Javascript개발자의 눈으로 python 들여다보기
자구4번
1 Python기초 오리엔테이션
Lua 문법
Perl Script
Ruby - 6th (루비 6장 변수와 식)
20160126_python
3주차 language
Light Tutorial Python
자료구조04
Ad

Code_The_Web_150531_Ruby_1

  • 1. Ruby Code The Web 세상에서 가장 아름다운 프로그래밍 언어 2015.05.31
  • 3. 웹 서비스의 기본 구성 Client Server “나 페이지 보여줘” “응 여기 있어” Request Response
  • 4. Static Website (대학 동아리 소개 웹사이트) Client Server “나 페이지 보여줘” “나 페이지 보여줘” “나 페이지 보여줘” “여기 똑같은 놈이야” “그래 이 남자야” “이 남자야”
  • 5. Dynamic Website (페이스북, 트위터) Client Server “나 페이지 보여줘” “나 페이지 보여줘” “나 페이지 보여줘” “넌 권한이 없어” “넌 노란 남자” “넌 파란 남자”
  • 8. Object-Oriented High-Level Scripting Language 모든 것이 객체다(진짜로) 컴파일이 필요없음 마치 영어 문장처럼 겁나 쉽게 쓰이고 읽힙니다
  • 9. Data Type 을 알아서 인식한다 my_age = 26 is_she_pretty = true my_favorite_quote = “You are a beautiful monkey”
  • 10. 변수 이름을 이렇게 쓰자 my_age = 26 1. 소문자로 시작한다 2. 단어들은 _ (underscore)으로 구분한다 myAge (X) My_age(X) 3. $, @등의 기호들로 시작하지 말자 $my_age (X)
  • 11. 연산 기호 25 + 2 = 27 5 - 3 = 2 3 * 4 = 12 5 / 4 = 1 2**3 = 8 10 % 7 = 3 덧셈 뺄셈 곱셈 나눗셈 지수 모듈 (나머지)
  • 12. 출력하기 puts “what is his name” print “is he hot” 출력한 후 빈 줄을 하나 추가한다 화면에 그냥 출력한다
  • 13. 이름 (String) 나이 (Integer) 어머님 나이(Integer) 본인이 AB형인지 아닌지 (Boolean) 2. puts 를 이용해서 이름을 출력해주세요 3. print 를 이용해서 어머니 나이와 본인 나이를 곱한 값을 출력해주세요 4. puts 를 이용해서 AB형 유무를 출력해주세요 1. 위의 값들을 각각의 변수에 넣어서 입력해주세요
  • 14. 반복자(Iterators) - while loop count = 1 while count <= 10 puts count count += 1 end
  • 15. 반복자(Iterators) - for loop for number in 1…10 puts “Hi” end
  • 16. 반복자(Iterators) - for loop animals = [“cats”, “dogs”, “monkeys”] for num in 0..2 puts animals[num] end
  • 17. 반복자(Iterators) - each loop animals = [“cats”, “dogs”, “monkeys”] animals.each do |x| puts x end
  • 18. 반복자(Iterators) while, for, each 반복자들을 활용해서 1 ~ 10000 의 숫자를 합친 값을 출력하세요
  • 19. Data 종류 - Symbol 표기 방식 :name String 과 같다고 생각하면 이해하기 쉽다 주로 함수 이름, 키 이름, 변수등의 ID 로 사용된다 예) student[:grade]
  • 20. Data 종류 - Array x = Array.new x << 10 x[1] = 99 y = ["Alice", 23, 7.3] x[2] = y[1] + y[-1]
  • 21. Data 종류 - Hash person = Hash.new person["last_name"] = "Rodriguez" person[:first_name] = “Alice" order = {"item" => "Corn Flakes", "weight" => 18} order = {:item => "Corn Flakes", :weight => 18} order = {item: "Corn Flakes", weight: 18}
  • 22. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way. 위 글은 Charles Dickens 명작인 <두 도시 이야기>의 오프닝 문단입니다. Hash를 이용하여 각 단어별로 문단에 등장하는 빈도수를 출력하세요 hint: String 의 split 함수 활요