Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

communitycreator
ruby

How to output any data using the $stdout method

okwudili onyejiaku

Overview

In Ruby, $stdout represents the current standard output and a global variable. It means we can also use it to output data.

Syntax

$stdout << data
Syntax for $stdout in Ruby

Return value

This method returns the data printed to the console.

Code example

Let's look at the code below:

# create a variable
name = "Okwudili"

$stdout << "hello " << name
$stdout << "\nWelcome to Edpresso\n"
Using the $stdout method in Ruby

RELATED TAGS

communitycreator
ruby
RELATED COURSES

View all Courses

Keep Exploring