-
Notifications
You must be signed in to change notification settings - Fork 41
Assignments #36
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
base: master
Are you sure you want to change the base?
Assignments #36
Conversation
|
Hi @skotwal, Please review the Anup's pull request for Day1 assignment. |
Day1/assignment.rb
Outdated
| c=a | ||
| a=b | ||
| b=c | ||
| puts "A=#{a} B=#{b}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont use puts inside the method.
Swap the values by using function swap.
and then print(puts) the values of a & b.
Also u can do by foll way,
def swap(a,b)
return b, a
end
Hint:- 1. parallel assignment/Multiple assignment in Ruby.
To swap values without creating third variable.
2. How function can return multiple values for in ruby.
|
Hi @anupk18 , Please check comments on your review. |
Day1/assignment.rb
Outdated
|
|
||
|
|
||
| # 4. Print 'Ho! Ho! Ho! Merry Christmas!' using string interpolation and * operator. | ||
| # Your answer here... | ||
| 'Ho! '*3+"Merry Christmas!" | ||
| =>Ho! Ho! Ho! Merry Christmas! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of + operator please use string interpolation.
like :-
"#{ 'Ho! ' * 3 } Merry Christmas!"
No description provided.