Chapter 14 Output

Table of Contents
14.1 The Echo Function
14.2 The Print Function

Cows allows to easily output strings and variables. Everything you display within Cows scripts will be simply inserted in the resulting HTML file.

14.1 The Echo Function

Synopsis

echo(string);

Description

echo() prints string into Cows' output; string can be any valid expression:

Example

The following script displays a quotation; please note that we must explicitly add newlines since echo() produces a verbatim copy of a string.

echo ("Man is the only animal that can remain on\n");
echo ("friendly terms with the victims he intends to\n");
echo ("eat until he eats them.\n");
echo ("-- Samuel Butler\n");

This is Cows' output:

Man is the only animal that can remain on
friendly terms with the victims he intends to
eat until he eats them.
-- Samuel Butler

Example (2)

Strings are passed as variables.

quote  = "You can't eat your friends and have them too.\n";
author = "-- Franz Kafka\n";
echo (quote);
echo (author);

This is Cows' output:

You can't eat your friends and have them too.
-- Franz Kafka

This manual can be downloaded from http://www.g-cows.org/.