CS 315
Homework Assignment 2


Assigned: December 4, 2026
Due: December 14, 2026, at 23:59

Logically Controlled Loops in Go, JavaScript, Julia, Python, and Ruby

In this assignment, you will investigate how Go, JavaScript, Julia, Python, and Ruby address the following design issues for logically controlled loops.

  1. Location of the test. Does the language provide a pretest form, a posttest form, or both?
  2. User-located loop control mechanisms. What mechanisms does the language provide for exiting a logically controlled loop from within its body?

Demonstrate each supported form with a runnable example. State in your report when a language does not provide a form.

Write one complete source file per language. Arrange and label the experiments in the order above. Use comparable inputs across languages so that differences in the output can be explained by the loop constructs. Write your own examples. You may use online compilers or interpreters.

Part A — Design Issues in Each Language (45 points)

For each language and each design issue, include the relevant code, the actual execution results, and an explanation of what the experiment shows.

Part B — Evaluation (10 points)

Compare the five languages in terms of the readability and writability of their logically controlled loops. Which language would you prefer for expressing these loops? Support your choice with examples from your experiments.

Part C — Learning Strategy (10 points)

Describe the resources and tools you used and how you designed your experiments. State the compiler, interpreter, or browser and its version. Include the URLs of any online compilers or interpreters you used.

Part D — Source Files (35 points)

Each program must run without errors in the environment named in your report. Comment your code to explain what each example demonstrates. Include the JavaScript code in the submitted HTML file so that it runs in a browser. State where the browser displays its output.

Submission

Upload a single .zip or .rar archive to Moodle before the due date. The archive must contain the following.

  1. Report (65 points). Submit Parts A, B, and C in ID_lastname_name_report.pdf.
  2. Source files (35 points). Submit the following files in a folder named Codes. Each file is worth 7 points.

Important Notes