Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Defining and Utilizing Functions in Ruby

via CodeSignal

Overview

Unlock the power of functions in Ruby to write cleaner, more reusable code. This course covers how to define functions, understand parameters and return values, and the scope of variables within functions. Practical examples and exercises will help solidify your ability to use functions effectively in diverse programming scenarios.

Syllabus

  • Lesson 1: Defining Functions - Basics and Syntax
    • Run Your First Ruby Function
    • Change the Greeting Function
    • Fix the Welcome Knight Function
    • Complete the Greeting Function
    • Write a Ruby Function
  • Lesson 2: Functions with Parameters - Customizing Behavior
    • Passing Arguments to Functions
    • Default Values for Parameters
    • Functions with Parameters Change
    • Fix the Broken Functions
    • Adding Function Parameters
    • Default Parameter Values in Functions
    • Functions with Heroes and Battles
  • Lesson 3: Functions Returning Values - Using Return Statements
    • Run the Adventure Cost Code
    • Adding a Discount Factor
    • Explicit Return for Adventure Cost
    • Fix the Treasure Value Calculation
    • Complete the Treasure Value Function
    • Calculating Travel Distance
  • Lesson 4: Understanding Variable Scope - Local and Global Variables
    • Understanding Global and Local Variables
    • Global and Local Variables Adjustments
    • Fix Variable Scope Bug
    • Understanding Variable Scope Clearly
    • Understanding Variable Scope Practice
  • Lesson 5: Nesting Function Calls. Functions as Arguments
    • Nested Function Calls in Action
    • Enhance Coffee Preparation Function
    • Modify Package Delivery Code
    • Complete the Email Program
    • Master Nesting Function Calls and Arguments

Reviews

Start your review of Defining and Utilizing Functions in Ruby

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.