Learn to Program with ZedLX

Free Online Programming Course for Beginners

Introduction [8/10]

The program displays the expressions along with their results.
[Run the program]

It may seem like the strings contain expressions, but that is not the case. Strings cannot contain expressions, they only contain text.

Strings are printed out exactly as they are written. In contrast, expressions like 3*4 and 2+5 are evaluated before being printed, and then their results are displayed.

Exercise:

  1. Add this statement to the program: println "3m × 4m = ", 3*4, "m²";

Loading...