Anders Tornblad, web developer

I'm all about the web

Label archive for hello world

"Hello, World!" in Pascal

How to do "Hello, World!" in Pascal.

program HelloWorld; begin WriteLn('Hello, World!'); end.

Pascal was one of the first computer languages I learned, back in the late 1980s and early 1990s. The Borland Turbo Pascal compiler was really fast, and I once actually took a university course in Computer Science, where we wrote code in Pascal on Macintosh computers. This was in 1996. A few years later, I had the opportunity to try Delphi 8 (Octane), which among other things had an immensly superior "Intellisense" solution.

I think I need to add Pascal definitions to my code formatting script...

For more "Hello, World!" examples, go to the Hello World category.

"Hello, World!" in ZX Spectrum machine code

How to do "Hello, World!" in ZX Spectrum machine code.

CHANOPEN equ 5633 PRINT equ 8252 ld a, 2 ; 3E 02 call CHANOPEN ; CD 01 16 ld de, text ; 11 xx xx ld bc, textend-text ; 01 0E jp PRINT ; 3C 20 text defb 'Hello, World!' defb 13 textend equ $

This piece of code calls two functions in the original ZX Spectrum ROM. First it calls CHAN-OPEN which sets the current output channel to number 2 (normal screen output), and then it calls PRINT, which prints a string of characters to the selected channel. To print this on a ZX Printer, simply select channel 3 instead.

I think I need to add Z80 assembler definitions to my code formatting script...

For more "Hello, World!" examples, go to the Hello World category.

"Hello, World!" in HTML

How to do "Hello, World!" in HTML5.

<!doctype html> <title>Hello, World!</title> <p>Hello, World!

Most of the structure of an HTML document, including the html, head and body elements, can be left out without invalidating the document. Also, most block-level elements are self-closing. For instance, the segment <p>Hello<div>World is perfectly equivalent to <p>Hello</p><div>World</div>, which sometimes can be unintuitive, especially in combination with CSS or the querySelector function.

For more "Hello, World!" examples, go to the Hello World category.

"Hello, World!" in JavaScript

How to do "Hello, World!" in JavaScript.

'use strict'; console.log('Hello, World!')

JavaScript has really matured over the last years. Though it started out as a browser-only language, giving grey hairs to web developers everywhere, it is now a competent language in its own right. Combined with initiatives such as node.js, it performs on par with all other system languages. The code above works in your browser (printing to the developer console) as well as in node.js (printing to your terminal output). And yes, you should always go for strict mode.

For more "Hello, World!" examples, go to the Hello World category.

"Hello, World!" in PHP

How to do "Hello, World!" in PHP.

<?php echo 'Hello, World!'; ?>

Even though PHP is mostly used for adding server-side functionality to web pages, PHP is actually a self-containing language that can be run on a lot of different platforms, both in a web server and completely stand-alone. When PHP is run inside a web server, the echo function renders output to the response of an HTTP request. When PHP is run from the command line, it prints to the console.

For more "Hello, World!" examples, go to the Hello World category.

"Hello, World!" in Java

How to do "Hello, World!" in Java.

public class Program { public static void main(String[] args) { System.out.println("Hello, World!"); } }

I have never really gotten into the Java world. I wrote some Java code in Notepad back in the 1990s and liked the language, but then I had the misfortune of having to use Eclipse at work a few times, and hated the whole experience, from installation to debugging.

For more "Hello, World!" examples, go to the Hello World category.

"Hello, World!" in C#

How to do "Hello, World!" in C#.

class Program { static void Main() { System.Console.WriteLine("Hello, World!"); } }

For writing desktop and server applications, C# has been my language of choice for over ten years now, both for work and for side projects. I really like PHP too, but I don't think it can measure up to the maturity of C#, even though PHP7 looks really nice. The size of the .NET Framework and all the Open Source NuGet packages available really help focusing on what to do, instead of how to do it.

For more "Hello, World!" examples, go to the Hello World category.