With the switch to Hugo, I wanted a place to test the syntax highlighting that comes with Chroma. This is that place, and we’ll use the classic “Hello, World!” example in various computer languages I have used in one way or another, past or present. Of course, let’s over-engineer it by having some pipelines do the output.
Languages
Ansible
- hosts: localhost
tasks:
- debug:
msg: "Hello, World!"
Bash
#!/bin/env bash
echo "Hello, World!"
Batch
@echo off
echo Hello, World!
C
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
}
C++
#include <iostream>
int main() {
std::cout << "Hello, World!\n";
}
C#
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello, World!");
}
}
CSS
body::before {
content: 'Hello, World!';
display: block;
}
Dockerfile
FROM alpine
CMD ["/bin/sh", "-c", "echo Hello, World!"]
HTML
<!DOCTYPE html>
Hello, World!
Go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
JavaScript
console.log('Hello, World!');
PHP
<?php
echo 'Hello, World!';
PowerShell
Write-Host "Hello, World!"
Python
print('Hello, World!')
SQL
SELECT 'Hello, World!';
TypeScript
console.log('Hello, World!');
Terraform
output "greeting" {
description = "Prints 'Hello, World!'"
value = "Hello, World!"
}