This document provides approved notation for developing pseudocode for IB Diploma Programme courses. It lists symbols that must be used in pseudocode, including those used in mathematics like =, >, <, and logical operators like AND and OR. It also provides examples of how to represent variable names, assigning values, output, loops, and conditional operations in pseudocode based on the approved notation. This information is to be distributed to candidates and will be available during external examinations.
The Ring programming language version 1.3 book - Part 12 of 88Mahmoud Samir Fayed
This document summarizes the different control structures available in the Ring programming language. It describes if/elseif/else statements, switch statements, while loops, for loops, and for-in loops. Examples are provided for each to demonstrate their syntax and usage. Exceptions handling is also briefly covered.
This document provides an overview of the basics of Python. It discusses code or source code, syntax, output, the console, compiling vs interpreting, the Python interpreter, expressions, operators, integer and real numbers, math commands, variables, print statements, input, the for loop, range, if/else statements, while loops, logic, and loop control statements. It also covers data types like numbers, strings, lists, sets, and dictionaries.
This document provides an introduction to programming with Python. It discusses several influential early programming languages like FORTRAN, COBOL, LISP, and BASIC. It also covers key Python concepts like expressions, variables, printing output, user input, repetition with for loops and while loops, conditional execution with if/else statements, string processing, and file I/O. The document is intended to teach basic Python syntax and structures to newcomers of the language.
The Ring programming language version 1.5.4 book - Part 20 of 185Mahmoud Samir Fayed
This document provides documentation on control structures and input functions in the Ring programming language. It describes if/elseif/else statements, switch statements, while loops, for loops, try/catch blocks, and functions for getting input like Give, GetChar(), and Input(). Examples are given for each to demonstrate their syntax and usage.
The Ring programming language version 1.7 book - Part 23 of 196Mahmoud Samir Fayed
This document provides information about control structures in Ring including if/elseif/else statements, switch statements, while loops, for loops, and exceptions. It includes syntax examples and explanations of each control structure type. Key points covered include branching with if/elseif/else and switch statements, looping with while, for, and for-in loops, and using try/catch blocks to handle exceptions.
Introduction to Ruby with accompanying code at https://github.com/heatherjc07/RubyIntroduction. Covers flow control, methods, classes and types
The document contains notes from Chapter 1 on algebra topics including: variables, expressions, equations, exponents, order of operations, real numbers, patterns and functions, scatter plots, and measures of central tendency. Lesson topics include using variables, exponents and order of operations, exploring real numbers, patterns and functions, scatter plots, and defining mean, median, mode, range and outliers. Examples are provided for writing expressions and equations, simplifying expressions, identifying functions, and calculating mean, median and mode.
The Ring programming language version 1.5.2 book - Part 19 of 181Mahmoud Samir Fayed
The document discusses various control structures in Ring including if/elseif/else statements, switch statements, while loops, for loops, and exceptions handling. It provides syntax examples for each structure, demonstrating how to exit loops, call functions within loops, use logical operators, and handle exceptions.
Ruby is a dynamic, open source object-oriented scripting language that is interpreted, not compiled. It supports features like garbage collection, exception handling, operator overloading, and just-in-time compilation. Ruby can be used for web development, system scripting, database programming, and GUI development. It uses classes and modules to support object-oriented programming concepts like inheritance, polymorphism, and mixins.
The document provides an outline of topics for a C/C++ tutorial, including a "Hello World" program, data types, variables, operators, conditionals, loops, arrays, strings, functions, pointers, command-line arguments, data structures, and memory allocation. It gives examples and explanations of key concepts in C/C++ programming.
Shows some advanced REXX techniques to make your programs more efficient and more readable for easier debugging. Also describes some tips for creating file and program structures not discussed in a typical REXX class.
Pseudo code practice problems+ c basicsakshay kumar
This document provides an overview of pseudocode practice problems and examples with solutions. It includes explanations of the main components of pseudocode including variables, assignment, input/output, selection, and repetition. Six examples of pseudocode problems are given with step-by-step solutions. Two homework problems are also provided with multiple solutions for writing pseudocode to sort three numbers and calculate a running sum by adding user-entered numbers until a negative number is entered.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements, for loops, and while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
Python is an interpreted programming language that can be used to perform calculations, handle text, and control program flow. It allows variables to store values that can later be used in expressions. Common operations include arithmetic, printing output, accepting user input, and repeating tasks using for loops and conditional statements like if/else. The interpreter executes Python code directly without a separate compilation step required by other languages.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements and for/while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
The document discusses various Ruby concepts including object-oriented programming (OOP), metaprogramming, blocks, iterators, mixins, duck typing, classes, modules, inheritance, include/extend, yield, enumerable, comparable, symbol to proc, transactions, and file handling. It provides code examples to illustrate these concepts.
This document provides an introduction and overview of the Ruby programming language. It discusses installing Ruby on Windows and Mac systems, data types including numbers, strings, and arrays. It also covers variables, arrays, iterators, methods including built-in and user-defined methods, and flow control including if/else conditional statements and while loops. The document encourages comments and feedback.
The document contains algorithms for 12 different programming questions:
1. A program to find the maximum number in a list.
2. A program to calculate the difference between the sum of squares and square of sums of two numbers.
3. A program to calculate total profit from ticket sales based on number of attendees.
4. A program to calculate volume and surface area of a cylinder given radius and height.
5. A program to count the number of words in a string.
6. A program to convert a decimal number to binary.
7. A program to calculate factorial of a number using recursion.
8. A program to reverse elements in an integer array without
Reason - introduction to language and its ecosystem | Łukasz StrączyńskiGrand Parade Poland
A moderately deep look at new language with OCaml roots. Is there a reason to be hyped about it? Is it mature enough to be considered production ready?
What does it offer over JS, Flow or other compiled to JS languages?
Slides from the Ruby Topic Maps Tutorial I gave at TMRA in October 2007. New upload for new RTM website: http://rtm.topicmapslab.de
This document provides an overview of key concepts in programming and Python. It defines terms like code, syntax, output, console, compiling, interpreting, and variables. It explains Python as an interpreted language and shows examples of printing output, taking user input, performing calculations with numbers and math commands, using variables, and basic control structures like if/else and loops. It also covers data types like integers, floats, strings, lists, and how to modify and format them.
/Regex makes me want to (weep_give up_(╯°□°)╯︵ ┻━┻)/i (for 2024 CascadiaPHP)brettflorio
REGEX! Love it or hate it, sometimes you actually need it. And when that time comes, there's no reason to be afraid or to ask help from that one weirdo on your team who actually loves regular expressions. (I'm that weirdo, fwiw.)
This session is geared towards beginning and intermediate regex users, as well as experienced programmers and developers who just don't really grok regex. We'll cover the following topics using practical examples that you might encounter in your own projects. (ie. No matching against "dog" and "cat".)
* What is regex? How's it work? A brief history.
* Syntax, special characters, character classes
* Grouping, capturing, and common gotchas
* Use cases for matching, validating, and replacing
* More advanced topics like backreferences and lookarounds
In this PPT you will learn how to use looping in python.
For more presentation in any subject please contact us on
[email protected].
You get a new presentation every Sunday at 10 AM.
Learn more about Python by clicking on given below link
Python Introduction- https://www.slideshare.net/RaginiJain21/final-presentation-on-python
Basic concept of Python -https://www.slideshare.net/RaginiJain21/python-second-ppt
Python Datatypes - https://www.slideshare.net/RaginiJain21/data-types-in-python-248466302
Python Library & Module - https://www.slideshare.net/RaginiJain21/python-libraries-and-modules
Basic Python Programs- https://www.slideshare.net/RaginiJain21/basic-python-programs
Python Media Libarary - https://www.slideshare.net/RaginiJain21/python-media-library
The Ring programming language version 1.9 book - Part 26 of 210Mahmoud Samir Fayed
This document provides documentation on looping and control flow structures in Ring. It discusses while, for, and for-in loops with examples. It also covers branching statements like if/elseif/else and switch/case and exceptions handling with try/catch. Looping structures allow repeated execution of a block of code and control flow specifies the order instructions are executed.
The Ring programming language version 1.4 book - Part 5 of 30Mahmoud Samir Fayed
The document discusses functions in Ring programming language. It covers defining functions, calling functions, declaring parameters, sending parameters, main function, variable scope, return values, and recursion. Some key points:
- Functions are defined using the func keyword followed by the function name and optional parameters. No ending keyword is needed.
- Functions can be called before they are defined.
- Parameters are declared after the function name as a comma separated list of identifiers.
- Parameters are sent to functions by listing them inside parentheses when calling.
- The optional main function is executed after other statements if defined.
The Ring programming language version 1.5.2 book - Part 19 of 181Mahmoud Samir Fayed
The document discusses various control structures in Ring including if/elseif/else statements, switch statements, while loops, for loops, and exceptions handling. It provides syntax examples for each structure, demonstrating how to exit loops, call functions within loops, use logical operators, and handle exceptions.
Ruby is a dynamic, open source object-oriented scripting language that is interpreted, not compiled. It supports features like garbage collection, exception handling, operator overloading, and just-in-time compilation. Ruby can be used for web development, system scripting, database programming, and GUI development. It uses classes and modules to support object-oriented programming concepts like inheritance, polymorphism, and mixins.
The document provides an outline of topics for a C/C++ tutorial, including a "Hello World" program, data types, variables, operators, conditionals, loops, arrays, strings, functions, pointers, command-line arguments, data structures, and memory allocation. It gives examples and explanations of key concepts in C/C++ programming.
Shows some advanced REXX techniques to make your programs more efficient and more readable for easier debugging. Also describes some tips for creating file and program structures not discussed in a typical REXX class.
Pseudo code practice problems+ c basicsakshay kumar
This document provides an overview of pseudocode practice problems and examples with solutions. It includes explanations of the main components of pseudocode including variables, assignment, input/output, selection, and repetition. Six examples of pseudocode problems are given with step-by-step solutions. Two homework problems are also provided with multiple solutions for writing pseudocode to sort three numbers and calculate a running sum by adding user-entered numbers until a negative number is entered.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements, for loops, and while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
Python is an interpreted programming language that can be used to perform calculations, handle text, and control program flow. It allows variables to store values that can later be used in expressions. Common operations include arithmetic, printing output, accepting user input, and repeating tasks using for loops and conditional statements like if/else. The interpreter executes Python code directly without a separate compilation step required by other languages.
The document provides an introduction to programming with Python. It discusses key concepts like code, syntax, output, and consoles. It also covers compiling vs interpreting languages, with Python being an interpreted language. The document explains expressions, variables, basic math operations, and functions in Python like print and input. It introduces control structures like if/else statements and for/while loops. It also covers different data types in Python including numbers, strings, lists, and dictionaries.
The document discusses various Ruby concepts including object-oriented programming (OOP), metaprogramming, blocks, iterators, mixins, duck typing, classes, modules, inheritance, include/extend, yield, enumerable, comparable, symbol to proc, transactions, and file handling. It provides code examples to illustrate these concepts.
This document provides an introduction and overview of the Ruby programming language. It discusses installing Ruby on Windows and Mac systems, data types including numbers, strings, and arrays. It also covers variables, arrays, iterators, methods including built-in and user-defined methods, and flow control including if/else conditional statements and while loops. The document encourages comments and feedback.
The document contains algorithms for 12 different programming questions:
1. A program to find the maximum number in a list.
2. A program to calculate the difference between the sum of squares and square of sums of two numbers.
3. A program to calculate total profit from ticket sales based on number of attendees.
4. A program to calculate volume and surface area of a cylinder given radius and height.
5. A program to count the number of words in a string.
6. A program to convert a decimal number to binary.
7. A program to calculate factorial of a number using recursion.
8. A program to reverse elements in an integer array without
Reason - introduction to language and its ecosystem | Łukasz StrączyńskiGrand Parade Poland
A moderately deep look at new language with OCaml roots. Is there a reason to be hyped about it? Is it mature enough to be considered production ready?
What does it offer over JS, Flow or other compiled to JS languages?
Slides from the Ruby Topic Maps Tutorial I gave at TMRA in October 2007. New upload for new RTM website: http://rtm.topicmapslab.de
This document provides an overview of key concepts in programming and Python. It defines terms like code, syntax, output, console, compiling, interpreting, and variables. It explains Python as an interpreted language and shows examples of printing output, taking user input, performing calculations with numbers and math commands, using variables, and basic control structures like if/else and loops. It also covers data types like integers, floats, strings, lists, and how to modify and format them.
/Regex makes me want to (weep_give up_(╯°□°)╯︵ ┻━┻)/i (for 2024 CascadiaPHP)brettflorio
REGEX! Love it or hate it, sometimes you actually need it. And when that time comes, there's no reason to be afraid or to ask help from that one weirdo on your team who actually loves regular expressions. (I'm that weirdo, fwiw.)
This session is geared towards beginning and intermediate regex users, as well as experienced programmers and developers who just don't really grok regex. We'll cover the following topics using practical examples that you might encounter in your own projects. (ie. No matching against "dog" and "cat".)
* What is regex? How's it work? A brief history.
* Syntax, special characters, character classes
* Grouping, capturing, and common gotchas
* Use cases for matching, validating, and replacing
* More advanced topics like backreferences and lookarounds
In this PPT you will learn how to use looping in python.
For more presentation in any subject please contact us on
[email protected].
You get a new presentation every Sunday at 10 AM.
Learn more about Python by clicking on given below link
Python Introduction- https://www.slideshare.net/RaginiJain21/final-presentation-on-python
Basic concept of Python -https://www.slideshare.net/RaginiJain21/python-second-ppt
Python Datatypes - https://www.slideshare.net/RaginiJain21/data-types-in-python-248466302
Python Library & Module - https://www.slideshare.net/RaginiJain21/python-libraries-and-modules
Basic Python Programs- https://www.slideshare.net/RaginiJain21/basic-python-programs
Python Media Libarary - https://www.slideshare.net/RaginiJain21/python-media-library
The Ring programming language version 1.9 book - Part 26 of 210Mahmoud Samir Fayed
This document provides documentation on looping and control flow structures in Ring. It discusses while, for, and for-in loops with examples. It also covers branching statements like if/elseif/else and switch/case and exceptions handling with try/catch. Looping structures allow repeated execution of a block of code and control flow specifies the order instructions are executed.
The Ring programming language version 1.4 book - Part 5 of 30Mahmoud Samir Fayed
The document discusses functions in Ring programming language. It covers defining functions, calling functions, declaring parameters, sending parameters, main function, variable scope, return values, and recursion. Some key points:
- Functions are defined using the func keyword followed by the function name and optional parameters. No ending keyword is needed.
- Functions can be called before they are defined.
- Parameters are declared after the function name as a comma separated list of identifiers.
- Parameters are sent to functions by listing them inside parentheses when calling.
- The optional main function is executed after other statements if defined.
A SEW-EURODRIVE brake repair kit is needed for maintenance and repair of specific SEW-EURODRIVE brake models, like the BE series. It includes all necessary parts for preventative maintenance and repairs. This ensures proper brake functionality and extends the lifespan of the brake system
This study will provide the audience with an understanding of the capabilities of soft tools such as Artificial Neural Networks (ANN), Support Vector Regression (SVR), Model Trees (MT), and Multi-Gene Genetic Programming (MGGP) as a statistical downscaling tool. Many projects are underway around the world to downscale the data from Global Climate Models (GCM). The majority of the statistical tools have a lengthy downscaling pipeline to follow. To improve its accuracy, the GCM data is re-gridded according to the grid points of the observed data, standardized, and, sometimes, bias-removal is required. The current work suggests that future precipitation can be predicted by using precipitation data from the nearest four grid points as input to soft tools and observed precipitation as output. This research aims to estimate precipitation trends in the near future (2021-2050), using 5 GCMs, for Pune, in the state of Maharashtra, India. The findings indicate that each one of the soft tools can model the precipitation with excellent accuracy as compared to the traditional method of Distribution Based Scaling (DBS). The results show that ANN models appear to give the best results, followed by MT, then MGGP, and finally SVR. This work is one of a kind in that it provides insights into the changing monsoon season in Pune. The anticipated average precipitation levels depict a rise of 300–500% in January, along with increases of 200-300% in February and March, and a 100-150% increase for April and December. In contrast, rainfall appears to be decreasing by 20-30% between June and September.
本資料「To CoT or not to CoT?」では、大規模言語モデルにおけるChain of Thought(CoT)プロンプトの効果について詳しく解説しています。
CoTはあらゆるタスクに効く万能な手法ではなく、特に数学的・論理的・アルゴリズム的な推論を伴う課題で高い効果を発揮することが実験から示されています。
一方で、常識や一般知識を問う問題に対しては効果が限定的であることも明らかになりました。
複雑な問題を段階的に分解・実行する「計画と実行」のプロセスにおいて、CoTの強みが活かされる点も注目ポイントです。
This presentation explores when Chain of Thought (CoT) prompting is truly effective in large language models.
The findings show that CoT significantly improves performance on tasks involving mathematical or logical reasoning, while its impact is limited on general knowledge or commonsense tasks.
David Boutry - Mentors Junior DevelopersDavid Boutry
David Boutry is a Senior Software Engineer in New York with expertise in high-performance data processing and cloud technologies like AWS and Kubernetes. With over eight years in the field, he has led projects that improved system scalability and reduced processing times by 40%. He actively mentors aspiring developers and holds certifications in AWS, Scrum, and Azure.
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...ijscai
International Journal on Soft Computing, Artificial Intelligence and Applications (IJSCAI) is an open access peer-reviewed journal that provides an excellent international forum for sharing knowledge and results in theory, methodology and applications of Artificial Intelligence, Soft Computing. The Journal looks for significant contributions to all major fields of the Artificial Intelligence, Soft Computing in theoretical and practical aspects. The aim of the Journal is to provide a platform to the researchers and practitioners from both academia as well as industry to meet and share cutting-edge development in the field.
Rearchitecturing a 9-year-old legacy Laravel application.pdfTakumi Amitani
An initiative to re-architect a Laravel legacy application that had been running for 9 years using the following approaches, with the goal of improving the system’s modifiability:
・Event Storming
・Use Case Driven Object Modeling
・Domain Driven Design
・Modular Monolith
・Clean Architecture
This slide was used in PHPxTKY June 2025.
https://phpxtky.connpass.com/event/352685/
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyYannis
The doctoral thesis trajectory has been often characterized as a “long and windy road” or a journey to “Ithaka”, suggesting the promises and challenges of this journey of initiation to research. The doctoral candidates need to complete such journey (i) preserving and even enhancing their wellbeing, (ii) overcoming the many challenges through resilience, while keeping (iii) high standards of ethics and (iv) scientific rigor. This talk will provide a personal account of lessons learnt and recommendations from a senior researcher over his 30+ years of doctoral supervision and care for doctoral students. Specific attention will be paid on the special features of the (i) interdisciplinary doctoral research that involves Information and Communications Technologies (ICT) and other scientific traditions, and (ii) the challenges faced in the complex technological and research landscape dominated by Artificial Intelligence.
3. CONDITION
• If statement
• If modifier
• Multiple if
• If else
• If else modifier
• Unless if
• Unless if modifier
• Case statement
4. Ruby if… Statement
SYNTAX
if conditional [then]
code...
end
• Note: The end keyword is required to indicate the
end of the if.
5. Example 1
To check some value greater or not
a = 42
if a > 7
puts "Yes“
end
Output:
yes
6. Example 2
To check two conditions
num = 16
if num > 7
puts "Greater than 7“
if num < 42
puts "Between 7 and
42“
end
end
Output:
Greater than 7
Between 7 and 42
7. Ruby if else… Statement
SYNTAX
if conditional [then]
code...
[elsif conditional [then]
code...]...
[else
code...]
end
• Note: The end keyword is only needed for the if statement, as
the else block is part of the if expression.
8. Example 3
To guess the age
age = 15
if age > 18
puts "Welcome“
else
puts "Too young“
end
Output:
Too young
9. Example 4
To guess the number greater than 2 or not
x = 1
if x > 2
puts "x is greater than 2"
elsif x < 2 and x!=0
puts "x is 1"
else
puts "I can't guess the
number"
end
Output:
x is 1
10. Example 5
To guess the number
num = 8
if num == 3
puts "Number is 3“
elsif num == 10
puts "Number is 10“
elsif num == 7
puts "Number is 7“
else
puts "Not found“
end
Output:
Not found
12. Example 6
To guess the number
debug = 1
print "debugn“ if debug
Output:
debug
13. Ruby unless Statement
SYNTAX
unless conditional [then]
code
[else
code ]
end
• Note: The unless expression is the opposite of an if expression. It
executes code when a conditional is false.
14. Example 7
To check the number greater or lesser
a = 42
unless a < 10
puts "Yes“
else
puts "No“
end
Output:
Yes
16. Example 8
To check the number greater or lesser
using unless
a = 42
puts "Yes" if a > 10
puts "Yes" unless a < 10
Output:
Yes
Yes
17. Example 9
Using unless in multiple if
var = 1
print "1 -- Value is setn" if var
print "2 -- Value is setn" unless var
var = false
print "3 -- Value is setn" unless var
Output:
1 -- Value is set
3 -- Value is set
18. Ruby case Statement
SYNTAX
case expression
[when expression [, expression ...] [then]
code ]...
[else
code ]
end
Note that the case expression must be closed with the end keyword.
19. Example 10
To guess the age
age = 5
case age
when 1, 2, 3
puts "Little baby"
when 4, 5
puts "Child“
end
Output:
Child
20. Example 11
To guess the age using else
age = 18
case age
when 1, 2, 3
puts "Little baby"
when 4, 5
puts "Child"
else
puts “Adult“
end
Output:
Adult
35. Accessing array elements
SYNTAX
puts array_name[index_value]
Example
puts items[0]
Note:
A negative index is assumed relative to the end of
the array. For example, an index of -1 indicates
the last element of the array.
36. Adding Elements
arr = [5, "Dave", 15.88, false]
puts arr[0]
puts arr[1]
puts arr[-1]
arr << 8
puts arr
arr.insert(2, 8)
5
Dave
false
5 Dave 15.88 false 8
5 Dave 8 15.88 false
CODE OUTPUT
39. Array Manipulations
Joining two arrays
a = [1, 2, 3]
b = [4, 5]
res = a + b
print res
Removing elements present in both array
a = [1, 2, 3, 4, 5]
b = [2, 4, 5, 6]
res = a – b
print res
[1, 2, 3, 4, 5]
[1, 3]
CODE OUTPUT
40. Array Manipulations
Return common elements
a = [2, 3, 7, 8]
b = [2, 7, 9]
print a & b
Join array and remove
duplicates
a = [2, 3, 7, 8]
b = [2, 7, 9]
print a | b
[2, 7]
[2, 3, 7, 8, 9]
CODE OUTPUT
41. For loop to iterate
arr = ["a", "b", "c"]
for x in arr
puts "Value: #{x}“
end
Value: a
Value: b
Value: c
CODE OUTPUT
42. Hashes
Hashes (sometimes known as associative
arrays, maps, or dictionaries) are similar to
arrays in that they are an indexed collection
of elements.
Example:
ages = { "David" => 28, "Amy"=> 19, "Rob" => 42 }
puts ages["Amy"]
48. Example 22
def sum(a, b=8)
puts a+b
end
x = 5
sum(x)
Note: You can also set default
values for the parameters, so
that the method will still work
even if you do not provide all
the arguments.
13
CODE OUTPUT
49. Example 21
def greet(name="")
if name==""
puts "Greetings!"
else
puts "Welcome,
#{name}"
end
end
greet(gets.chomp)
Welcome, hi
CODE OUTPUT
53. Example 24
def test
puts "You are in the method"
yield
puts "You are again back to
the method"
yield
end
test {puts "You are in the
block"}
You are in the method
You are in the block
You are again back to the
method
You are in the block
CODE OUTPUT
54. Example 25
def test
yield 5
puts "You are in the method
test"
yield 100
end
test {|i| puts "You are in the
block #{i}"}
You are in the block 5
You are in the method test
You are in the block 100
CODE OUTPUT