SlideShare a Scribd company logo
Ruby-Cheatsheet
A beginner's guide to learning Ruby
github.com/lifeparticle/Ruby-Cheatsheet
HI!
"ZAMAN".capitalize
Zaman
TABLEOFCONTENTS
int [] a = {12,45,56,35};
for (int n : a) {
System.out.println(n);
}
[12,45,56,35].each { |n| puts n }
puts [12,45,56,35].join("n")
[12,45,56,35].each do |n|
puts n
end
numbers = [2, 2, 2, 2,
2]
sum = 0
for value in numbers
sum += value
end
puts sum
numbers = [2, 2, 2, 2,
2]
puts numbers.reduce(:+)
def sum (a, b)
10
end
sum 5, 5
def sum (a, b)
a + b
end
sum 5, 6
def sum (a, b)
return a + b
end
sum 5, 6
['a','e','i','o','u'].include? 'a'
true
name = "ZAMAN"
name.downcase
puts "#{name}"
ZAMAN
name.downcase!
puts "#{name}"
zaman
numbers = [*1..10]
[1, 2, 3, 4, 5, 6,
7, 8, 9, 10]
range = 1...10
range.to_a
[1, 2, 3, 4, 5, 6,
7, 8, 9]
range = 1..10
range.cover?(5)
true
range = 1..10
range.to_a
[1, 2, 3, 4, 5, 6,
7, 8, 9, 10]
def method_name(floors, *values)
# evaluate business logics
floors.reduce(:+)
end
method_name([5, 2, 6, 87], "alarm alarm", "false alarm")
method_name([1, 1, 1, 1, 1, 1, 1, 1, 1], "not a drill")
temp = 19
if temp >= 25
puts "hot"
elsif temp < 25 && temp >= 18
puts "normal"
else
puts "cold"
end
name = "rob"
unless name == "bob"
puts "hello stranger"
else
puts "hello bob"
end
count = 1
puts "hello world" if count == 1
Does anyone have any questions?
mahbub.ninja
THANKS

More Related Content

What's hot

VTU Network lab programs
VTU Network lab   programsVTU Network lab   programs
VTU Network lab programs
Ananda Kumar HN
 
Merge sort
Merge sortMerge sort
Merge sort
Hitesh Kumar
 
Uts
UtsUts
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
ashikul akash
 
Graph Algebra
Graph AlgebraGraph Algebra
Graph Algebra
Roi Lipman
 
Assignement c++
Assignement c++Assignement c++
Assignement c++
Syed Umair
 
Understanding the nodejs event loop
Understanding the nodejs event loopUnderstanding the nodejs event loop
Understanding the nodejs event loop
Saurabh Kumar
 
Warna rgb
Warna rgbWarna rgb
Warna rgb
kiuntoro
 
Data structure
Data structureData structure
Data structure
Markustec
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
Lakshmi Sarvani Videla
 
benpresentation_django
benpresentation_djangobenpresentation_django
benpresentation_django
iiilx
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
Aram SE
 
/Root/exam unidad1/muestraip red
/Root/exam unidad1/muestraip red/Root/exam unidad1/muestraip red
/Root/exam unidad1/muestraip red
AntonioAlejoAquino
 
Effective approaches to attention based neural machine translation
Effective approaches to attention based neural machine translationEffective approaches to attention based neural machine translation
Effective approaches to attention based neural machine translation
성환 홍
 
Enjoyable Front-end Development with Reagent
Enjoyable Front-end Development with ReagentEnjoyable Front-end Development with Reagent
Enjoyable Front-end Development with Reagent
Thiago Fernandes Massa
 
Jsr310 - Java 8 Date and Time API
Jsr310 - Java 8 Date and Time APIJsr310 - Java 8 Date and Time API
Jsr310 - Java 8 Date and Time API
Ady Liu
 

What's hot (16)

VTU Network lab programs
VTU Network lab   programsVTU Network lab   programs
VTU Network lab programs
 
Merge sort
Merge sortMerge sort
Merge sort
 
Uts
UtsUts
Uts
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
Graph Algebra
Graph AlgebraGraph Algebra
Graph Algebra
 
Assignement c++
Assignement c++Assignement c++
Assignement c++
 
Understanding the nodejs event loop
Understanding the nodejs event loopUnderstanding the nodejs event loop
Understanding the nodejs event loop
 
Warna rgb
Warna rgbWarna rgb
Warna rgb
 
Data structure
Data structureData structure
Data structure
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
benpresentation_django
benpresentation_djangobenpresentation_django
benpresentation_django
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
 
/Root/exam unidad1/muestraip red
/Root/exam unidad1/muestraip red/Root/exam unidad1/muestraip red
/Root/exam unidad1/muestraip red
 
Effective approaches to attention based neural machine translation
Effective approaches to attention based neural machine translationEffective approaches to attention based neural machine translation
Effective approaches to attention based neural machine translation
 
Enjoyable Front-end Development with Reagent
Enjoyable Front-end Development with ReagentEnjoyable Front-end Development with Reagent
Enjoyable Front-end Development with Reagent
 
Jsr310 - Java 8 Date and Time API
Jsr310 - Java 8 Date and Time APIJsr310 - Java 8 Date and Time API
Jsr310 - Java 8 Date and Time API
 

Similar to Ruby talk

Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
Arturo Herrero
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
André Faria Gomes
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”
Platonov Sergey
 
Basics
BasicsBasics
[SI] Ada Lovelace Day 2014 - Tampon Run
[SI] Ada Lovelace Day 2014  - Tampon Run[SI] Ada Lovelace Day 2014  - Tampon Run
[SI] Ada Lovelace Day 2014 - Tampon Run
Maja Kraljič
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
Scott Leberknight
 
07012023.pptx
07012023.pptx07012023.pptx
07012023.pptx
NareshBopparathi1
 
Voce Tem Orgulho Do Seu Codigo
Voce Tem Orgulho Do Seu CodigoVoce Tem Orgulho Do Seu Codigo
Voce Tem Orgulho Do Seu Codigo
Victor Hugo Germano
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
Adam Dudczak
 
funwithalgorithms.pptx
funwithalgorithms.pptxfunwithalgorithms.pptx
funwithalgorithms.pptx
Tess Ferrandez
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
Baruch Sadogursky
 
Vcs9
Vcs9Vcs9
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
ikdysfm
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2
Evgeny Borisov
 
Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)
hasan0812
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
niklal
 
Coding
CodingCoding
[EN] Ada Lovelace Day 2014 - Tampon run
[EN] Ada Lovelace Day 2014  - Tampon run[EN] Ada Lovelace Day 2014  - Tampon run
[EN] Ada Lovelace Day 2014 - Tampon run
Maja Kraljič
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
Lei Kang
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
Mahmoud Samir Fayed
 

Similar to Ruby talk (20)

Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”
 
Basics
BasicsBasics
Basics
 
[SI] Ada Lovelace Day 2014 - Tampon Run
[SI] Ada Lovelace Day 2014  - Tampon Run[SI] Ada Lovelace Day 2014  - Tampon Run
[SI] Ada Lovelace Day 2014 - Tampon Run
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
07012023.pptx
07012023.pptx07012023.pptx
07012023.pptx
 
Voce Tem Orgulho Do Seu Codigo
Voce Tem Orgulho Do Seu CodigoVoce Tem Orgulho Do Seu Codigo
Voce Tem Orgulho Do Seu Codigo
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
funwithalgorithms.pptx
funwithalgorithms.pptxfunwithalgorithms.pptx
funwithalgorithms.pptx
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Vcs9
Vcs9Vcs9
Vcs9
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2
 
Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
 
Coding
CodingCoding
Coding
 
[EN] Ada Lovelace Day 2014 - Tampon run
[EN] Ada Lovelace Day 2014  - Tampon run[EN] Ada Lovelace Day 2014  - Tampon run
[EN] Ada Lovelace Day 2014 - Tampon run
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
 

More from Lifeparticle

Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)
Lifeparticle
 
Android security and parsing 101
Android security  and parsing  101Android security  and parsing  101
Android security and parsing 101
Lifeparticle
 
All about android
All about androidAll about android
All about android
Lifeparticle
 
Android SMS (GDayX, Dhaka, Bangladesh)
Android SMS (GDayX, Dhaka, Bangladesh)Android SMS (GDayX, Dhaka, Bangladesh)
Android SMS (GDayX, Dhaka, Bangladesh)
Lifeparticle
 
WorkShop on Arduino
WorkShop on Arduino WorkShop on Arduino
WorkShop on Arduino
Lifeparticle
 
Command line
Command lineCommand line
Command line
Lifeparticle
 
Buacm 2
Buacm 2Buacm 2
Buacm 2
Lifeparticle
 
Buacm 3
Buacm 3Buacm 3
Buacm 3
Lifeparticle
 
Buacm 1
Buacm 1Buacm 1
Buacm 1
Lifeparticle
 
Graph theory
Graph theoryGraph theory
Graph theory
Lifeparticle
 
Icpc team registration guide for coach
Icpc team registration guide for coachIcpc team registration guide for coach
Icpc team registration guide for coach
Lifeparticle
 
Workshop on python
Workshop on pythonWorkshop on python
Workshop on python
Lifeparticle
 

More from Lifeparticle (12)

Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)
 
Android security and parsing 101
Android security  and parsing  101Android security  and parsing  101
Android security and parsing 101
 
All about android
All about androidAll about android
All about android
 
Android SMS (GDayX, Dhaka, Bangladesh)
Android SMS (GDayX, Dhaka, Bangladesh)Android SMS (GDayX, Dhaka, Bangladesh)
Android SMS (GDayX, Dhaka, Bangladesh)
 
WorkShop on Arduino
WorkShop on Arduino WorkShop on Arduino
WorkShop on Arduino
 
Command line
Command lineCommand line
Command line
 
Buacm 2
Buacm 2Buacm 2
Buacm 2
 
Buacm 3
Buacm 3Buacm 3
Buacm 3
 
Buacm 1
Buacm 1Buacm 1
Buacm 1
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Icpc team registration guide for coach
Icpc team registration guide for coachIcpc team registration guide for coach
Icpc team registration guide for coach
 
Workshop on python
Workshop on pythonWorkshop on python
Workshop on python
 

Recently uploaded

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
Rakesh Kumar R
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
AnkitaPandya11
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 

Recently uploaded (20)

UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
What next after learning python programming basics
What next after learning python programming basicsWhat next after learning python programming basics
What next after learning python programming basics
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 

Ruby talk

  • 1. Ruby-Cheatsheet A beginner's guide to learning Ruby github.com/lifeparticle/Ruby-Cheatsheet
  • 4.
  • 5. int [] a = {12,45,56,35}; for (int n : a) { System.out.println(n); } [12,45,56,35].each { |n| puts n } puts [12,45,56,35].join("n") [12,45,56,35].each do |n| puts n end
  • 6. numbers = [2, 2, 2, 2, 2] sum = 0 for value in numbers sum += value end puts sum numbers = [2, 2, 2, 2, 2] puts numbers.reduce(:+)
  • 7. def sum (a, b) 10 end sum 5, 5 def sum (a, b) a + b end sum 5, 6 def sum (a, b) return a + b end sum 5, 6
  • 8. ['a','e','i','o','u'].include? 'a' true name = "ZAMAN" name.downcase puts "#{name}" ZAMAN name.downcase! puts "#{name}" zaman
  • 9. numbers = [*1..10] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] range = 1...10 range.to_a [1, 2, 3, 4, 5, 6, 7, 8, 9] range = 1..10 range.cover?(5) true range = 1..10 range.to_a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  • 10. def method_name(floors, *values) # evaluate business logics floors.reduce(:+) end method_name([5, 2, 6, 87], "alarm alarm", "false alarm") method_name([1, 1, 1, 1, 1, 1, 1, 1, 1], "not a drill")
  • 11. temp = 19 if temp >= 25 puts "hot" elsif temp < 25 && temp >= 18 puts "normal" else puts "cold" end name = "rob" unless name == "bob" puts "hello stranger" else puts "hello bob" end count = 1 puts "hello world" if count == 1
  • 12. Does anyone have any questions? mahbub.ninja THANKS