Giter Site home page Giter Site logo

aschonely83 / programming-univbasics-3-ruby-method-arguments-lab-online-web-prework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-students/programming-univbasics-3-ruby-method-arguments-lab-online-web-prework

0.0 1.0 0.0 8 KB

License: Other

Ruby 100.00%

programming-univbasics-3-ruby-method-arguments-lab-online-web-prework's Introduction

Ruby Method Arguments Lab

Learning Goals

  • Define a method that takes in and uses an argument
  • Define a method that takes in and uses two arguments
  • Define a method with an optional argument

Introduction

Now that we've seen a few ways of defining methods to add key functionality to our programs, let's try writing our own methods. You can use the tests to help guide you by running learn or learn test in your terminal, however, this look familiar to you now.

You'll be coding your methods in lib/introduction.rb.

Define a Method That Takes in and Uses an Argument

Define a method, #introduction that takes in the argument name and outputs the phrase: "Hi, my name is #{name}."

Define a Method That Takes in and Uses Two Arguments

Define a method, #introduction_with_language that takes in two arguments, name and language and outputs the phrase: "Hi, my name is #{name} and I am learning to program in #{language}."

Define a Method With an Optional Argument

Copy the previous method and name it #introduction_with_language_optional. It that takes in two arguments,name and language, but language is optional. The default value for language will be "Ruby".

Conclusion

We've talked about defining methods and passing in both required and optional arguments. This will be the foundation of creating a lot of functionality in Ruby.

programming-univbasics-3-ruby-method-arguments-lab-online-web-prework's People

Contributors

aschonely83 avatar drakeltheryuujin avatar maxwellbenton avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.