Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

done question one and two #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ruby-methods/methods.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
require 'pry'
# Ruby Methods
## Q1 Write any simple Ruby Program to illustrate the defining and calling of method
def greetings_method(name)
puts "Hallo, #{name}"
end

greetings_method('Sam')

# binding.pry

## Q2 You have a string, "I love espresso", return the length of the string
def string_length
str = "I love espresso".length
puts str
end

string_length

## Q3 Write a method where var1 and var2 are the parameters. Call the method. The statements to be executed are:
#"Phase-1 was all about Introduction to Programming."
Expand Down