Markdown Time to Say Hello
Last active
June 23, 2020 11:35
-
-
Save dlOuOlb/db775f70f41f9cfbc0bcae4ea2f32b52 to your computer and use it in GitHub Desktop.
Hello, world!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With Ada.Text_IO; use Ada.Text_IO; | |
With Ada.Command_Line; use Ada.Command_Line; | |
-- Ada Time to Say Hello | |
Procedure Hello is | |
Package IO renames Ada.Text_IO; | |
Package CMD renames Ada.Command_Line; | |
Begin | |
IO.put_line( Item => "Hello, world!" ); | |
Exception | |
When others => -- intentional catch-all | |
CMD.set_exit_status( Code => CMD.Failure ); | |
End Hello; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* B Time to Say Hello */ | |
main( ) | |
{ | |
extrn printf; | |
printf( "Hello, world!*n" ); | |
/* Never fail? */ | |
return( 0 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ Brainfuck Time to Say Hello ] | |
-[------->+<]>-. | |
-[->+++++<]>++. | |
+++++++. | |
. | |
+++. | |
[->+++++<]>+. | |
------------. | |
--[->++++<]>-. | |
--------. | |
+++. | |
------. | |
--------. | |
-[--->+<]>. | |
[--->+<]>-. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
///<summary> C Time to Say Hello </summary> | |
///<returns> Program Execution Status </returns> | |
extern int main( void ) | |
{ | |
return | |
( 0 > puts( "Hello, world!" ) )? | |
( EXIT_FAILURE ): | |
( EXIT_SUCCESS ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*> Common Business Oriented Language Time to Say Hello | |
IDENTIFICATION DIVISION. | |
PROGRAM-ID. HELLO-WORLD. | |
PROCEDURE DIVISION. | |
DISPLAY 'Hello, world!'. | |
*> Never fail? | |
STOP RUN. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transpilation is required. | |
###* CoffeeScript Node Time to Say Hello ### | |
Con = require 'console' | |
Proc = require 'process' | |
if ( module is require.main ) | |
then \ | |
( | |
try | |
Con.log 'Hello, world!' | |
catch # intentional catch-all | |
Proc.exit 1.0 | |
finally # reachable only unless exit | |
) | |
else | |
throw 'Main please!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export module Hello; | |
import <cstdlib>; | |
import <iostream>; | |
///<summary> C++ Time to Say Hello </summary> | |
///<returns> Program Execution Status </returns> | |
export extern R"(C++)" auto main( ) -> int | |
{ | |
namespace S = std; | |
if( S::cout << R"(Hello, world!)" << S::endl ) [[ likely ]] | |
return EXIT_SUCCESS; | |
else [[ unlikely ]] | |
return EXIT_FAILURE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Hello | |
{ | |
using S = System; | |
///<summary> Class for Main Routine </summary> | |
public static class World: S.Object | |
{ | |
///<summary> C# .NET Time to Say Hello </summary> | |
///<returns> Zero for success, non-zero for failure. </returns> | |
public static int Main( ) | |
{ | |
try | |
{ S.Console.WriteLine( value: @"Hello, world!" ); } | |
catch // intentional catch-all | |
{ return 1; } | |
finally | |
{ } | |
{ return 0; } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module hello; | |
/** D Time to Say Hello | |
Returns: Program Execution Status | |
*/ | |
extern( D ): | |
export static nothrow int main( ) | |
{ | |
static import | |
Obj = object, | |
IO = std.stdio, | |
CStdLib = core.stdc.stdlib; | |
try | |
{ IO.writeln( `Hello, world!` ); } | |
catch( Obj.Throwable ) // intentional catch-all | |
{ return CStdLib.EXIT_FAILURE; } | |
finally | |
{ } | |
{ return CStdLib.EXIT_SUCCESS; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export r'./hello.dart'; | |
import r'dart:io' as IO; | |
/// Dart Time to Say Hello | |
void main( ) | |
{ | |
try | |
{ return IO.stdout.writeln( r'Hello, world!' ); } | |
catch( E ) // intentional catch-all | |
{ return IO.exit( 0 ); } // but never return | |
finally // reachable only unless exit | |
{ } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing( main ) | |
import Html as H | |
{-| Elm Time to Say Hello -} | |
main : H.Html msg | |
main = H.main_[ ][ H.p[ ][ H.text "Hello, world!" ] ] | |
-- Never fail? | |
-- No tab, seriously? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% @doc Module for Main Routine | |
-module( hello ). | |
-export( [ start/0 ] ). | |
-compile( [ no_auto_import, compressed ] ). | |
-spec start( ) -> ok. | |
%% @doc Erlang/OTP Time to Say Hello | |
start( ) -> | |
E = erlang, IO = io, | |
try IO:fwrite( "Hello, world!~.. n" ) of | |
_ -> ok | |
catch | |
_:_ -> E:halt( 1 ) % intentional catch-all | |
after % reachable only unless halt | |
ok % but just discarded | |
end | |
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! Fortran Time to Say Hello | |
Program Hello | |
Implicit None | |
integer :: E | |
Write( IOStat = E, Unit = *, Fmt = * )& | |
'Hello, world!' | |
If( 0 == E )& | |
Then; Return | |
Else; Stop 1 | |
End If | |
End Program Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env fan | |
** Fantom Time to Say Hello | |
public final const class Hello | |
{ | |
public static sys::Int main( ) | |
{ | |
try | |
{ sys::Env.cur( ).out( ).printLine( "Hello, world!" ); } | |
catch // intentional catch-all | |
{ return 1; } | |
finally | |
{ } | |
return 0; | |
} | |
} | |
// How to alias 'sys', rather than omitting it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#light "off" | |
#nowarn "62" // --mlcompatibility | |
type Con = System.Console; | |
///<summary> F# .NET Time to Say Hello </summary> | |
///<returns> Zero for success, non-zero for failure. </returns> | |
[< EntryPoint >] | |
let public Main( _:string[ ] ):int = | |
try | |
Con.WriteLine( value = @"Hello, world!" ); 0; | |
with | |
| _ -> 1; // intentional catch-all | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go Time to Say Hello | |
package main; | |
import ( S `os`; Fm `fmt`; ); | |
func main( ) { | |
if _, E:= Fm.Println( `Hello, world!` ); | |
( nil == E ) { return; } else { S.Exit( 1 ); } | |
/*-- main */ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env groovy | |
package Hello | |
import java.lang.System as S; | |
/** Class for Main Routine */ | |
public final class World extends groovy.lang.Script | |
{ | |
/** Groovy Time to Say Hello */ | |
def run( ) | |
{ | |
try | |
{ S.out.println( 'Hello, world!' ); } | |
catch( java.lang.Throwable E ) // intentional catch-all | |
{ S.exit( 1 ); } | |
finally // reachable only unless exit | |
{ return; } | |
} | |
} | |
// How to alias 'java.lang' and 'groovy.lang', rather than omitting them? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -fno-warn-tabs #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
module Main( main ) where | |
import qualified Prelude as P; | |
import qualified System.Exit as Bye; | |
import qualified Control.Exception as Fault; | |
-- | Haskell Time to Say Hello | |
main:: P.IO ( ); | |
main = Fault.catch( P.putStrLn P.$ "Hello, world!" ) take where | |
take:: Fault.SomeException -> P.IO ( ) -- intentional catch-all | |
take _ = Bye.exitFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<HTML> | |
<Head> | |
<Meta CharSet="UTF-8"/> | |
<Title>Hello</Title> | |
</Head> | |
<!-- Hypertext Markup Language Time to Say Hello --> | |
<Body> | |
<P>Hello, world!</P> | |
</Body> | |
</HTML> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main | |
import Prelude.Interactive as Act; | |
||| Idris Time to Say Hello | |
public export | |
main : IO Unit; | |
main = do{ Act.putStrLn "Hello, world!"; }; | |
-- Never fail? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env io | |
# Io Time to Say Hello | |
if \ | |
( | |
isLaunchScript, | |
return( if( try( writeln( """Hello, world!""" ) ), 1.0, 0.0 ) ), | |
Exception raise( """Main please!""" ) | |
) | |
# Messages are implicitly sent to 'Object'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'memo': 'struct':: | |
{ | |
'id': 'int':: 31, | |
'name': 'string':: "hello", | |
'message': 'string':: "Hello, world!", | |
'description': 'string':: "Ion Time to Say Hello" | |
} | |
} | |
// comments and annotations might be suppressed after down-converting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Class for Main Routine */ | |
public final class hello extends java.lang.Object | |
{ | |
private static final java.lang.System S = null; | |
/** Java Time to Say Hello | |
* @param A Unused. | |
* @return Nothing. | |
*/ | |
public static final void main | |
( | |
@java.lang.SuppressWarnings( value = "unused" ) | |
java.lang.String... A | |
) | |
{ | |
try | |
{ S.out.println( "Hello, world!" ); } | |
catch // intentional catch-all | |
( | |
@java.lang.SuppressWarnings( value = "unused" ) | |
java.lang.Throwable E | |
) | |
{ S.exit( 1 ); } | |
finally // reachable only unless exit | |
{ return; } | |
} | |
} | |
// How to alias 'java.lang', rather than omitting it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env julia | |
module Hello | |
using Base; | |
const J = Base; | |
# Julia Time to Say Hello | |
if ( ( J.@__FILE__ ) == J.Filesystem.abspath( J.PROGRAM_FILE ) ) | |
try # J.raw"non-standard raw string" | |
J.println( J.raw"Hello, world!" ); | |
catch # intentional catch-all | |
J.exit( 1 ); | |
finally # reachable only unless exit | |
end | |
else | |
J.error( J.raw"Main please!" ); | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
/** JavaScript Node Time to Say Hello */ | |
'use strict'; | |
const Con = require( 'console' ); | |
const Proc = require( 'process' ); | |
if( module === require.main ) | |
try | |
{ Con.log( 'Hello, world!' ); } | |
catch // intentional catch-all | |
{ Proc.exit( 1.0 ); } | |
finally // reachable only unless exit | |
{ } | |
else | |
throw 'Main please!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"memo": | |
{ | |
"id": 31, | |
"name": "hello", | |
"message": "Hello, world!", | |
"description": "JavaScript Object Notation Time to Say Hello" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello; | |
/** Kotlin Time to Say Hello | |
* @param A Unused. | |
* @return Nothing. | |
*/ | |
public fun main | |
( | |
@kotlin.Suppress( """UNUSED_PARAMETER""" ) | |
A:kotlin.Array< kotlin.String > = kotlin.arrayOf< kotlin.String >( ) | |
) | |
:kotlin.Unit | |
{ | |
try | |
{ return kotlin.io.println( message = """Hello, world!""" ); } // kotlin.Unit | |
catch( _:kotlin.Throwable ) // intentional catch-all | |
{ kotlin.system.exitProcess( status = 1 ); } // kotlin.Nothing | |
finally // reachable only unless exitProcess | |
{ } | |
} | |
// How to alias 'kotlin', rather than omitting it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@msg = internal constant [ 14 x i8 ] c"Hello, world!\00" | |
declare i32 @puts( i8* ) nounwind | |
; LLVM IR Time to Say Hello | |
define i32 @main( ) nounwind | |
{ | |
%ptr = getelementptr [ 14 x i8 ], [ 14 x i8 ]* @msg, i32 0, i32 0 | |
%val = call i32 @puts( i8* %ptr ) nounwind | |
%con = lshr i32 %val, 31 | |
ret i32 %con | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transpilation is required. | |
/** LiveScript Node Time to Say Hello */ | |
const Con = require 'console' | |
const Proc = require 'process' | |
if ( module is require.main ) | |
then | |
try | |
Con.log 'Hello, world!' | |
catch # intentional catch-all | |
Proc.exit 1.0 | |
finally # reachable only unless exit | |
else | |
throw 'Main please!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env lua | |
-- Lua Time to Say Hello | |
local IO <const> = require( [[io]] ) | |
local OS <const> = require( [[os]] ) | |
local Mo <const> = require( [[package]] ) | |
if ( [[userdata]] == type( Mo.loaded[ ( ... ) ] ) ) | |
then error( [[Main please!]] ) | |
elseif ( IO.stdout == IO.output( IO.stdout ):write( 'Hello, world!\n' ) ) | |
then | |
else OS.exit( false ) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% MATLAB Time to Say Hello | |
function[ Ex ] = hello( ) | |
try | |
disp( 'Hello, world!' ); | |
catch % intentional catch-all | |
Ex = 1; | |
return; | |
end | |
Ex = 0; | |
return; | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** Objective Caml Time to Say Hello *) | |
module S = Stdlib | |
let ( ) = | |
if !S.Sys.interactive | |
then | |
S.failwith {|Main please!|} | |
else | |
try | |
S.Printf.printf "Hello, world!\n" | |
with | |
| _ -> S.exit 1 (* intentional catch-all *) | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Hello | |
{ | |
using S = System; | |
///<summary> Class for Main Routine </summary> | |
public static class World | |
{ | |
///<summary> Nemerle .NET Time to Say Hello </summary> | |
///<returns> Zero for success, non-zero for failure. </returns> | |
public static Main( ):int | |
{ | |
try | |
{ S.Console.WriteLine( value = @"Hello, world!" ); 0; } | |
catch | |
{ | _ => 1; } // intentional catch-all | |
finally | |
{ } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env nim | |
#? replace( sub = "\t", by = " " ) | |
## Nim Time to Say Hello | |
import system as S | |
when S.isMainModule: | |
try: | |
S.echo( x = r"Hello, world!" ) | |
except: # intentional catch-all | |
S.quit( errorcode = S.QuitFailure ) | |
finally: # reachable only unless quit | |
discard | |
else: | |
raise S.newException( exceptn = S.IOError, message = r"Main please!" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Mozart/Oz Time to Say Hello | |
functor | |
import | |
System | |
Application | |
define | |
try | |
{ System.showInfo 'Hello, world!' } | |
catch _ then % intentional catch-all | |
{ Application.exit 1 } | |
finally % reachable only unless exit | |
skip | |
end | |
end | |
% How to alias 'System' and 'Application', rather than omitting them? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$Mode ISO} | |
{$IOChecks Off} | |
{$ImplicitExceptions Off} | |
{$Optimization On} | |
{$Macro On} | |
{$Define S:=System} | |
{ Pascal Time to Say Hello } | |
Program Hello; | |
Begin | |
S.WriteLn( 'Hello, world!' ); | |
If ( S.IOResult = 0 ) | |
Then S.ExitCode:= 0 | |
Else S.ExitCode:= 1; | |
End. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env php | |
<?php | |
namespace Hello; | |
/** PHP: Hypertext Preprocessor Time to Say Hello */ | |
if( $argv && $argv[ 0 ] && ( __FILE__ === \RealPath( $argv[ 0 ] ) ) ) | |
if( \FWrite( \STDOUT, 'Hello, world!' . \PHP_EOL ) ); | |
else | |
Exit( 1 ); | |
else | |
throw new \Exception( 'Main please!' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env pike | |
// Pike Time to Say Hello | |
public int main( ) | |
{ | |
object IO = Stdio; | |
return ( 0 > IO.stdout->write( "Hello, world!\n" ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! usr/bin/env perl | |
=pod | |
Perl Time to Say Hello | |
=cut | |
use strict; | |
use warnings; | |
package Main; | |
CORE::if( CORE::caller ) | |
{ CORE::die 'Main please!'; } | |
CORE::else | |
{ | |
CORE::eval | |
{ CORE::say 'Hello, world!'; } | |
CORE::or CORE::do | |
{ CORE::exit 1; } | |
} | |
# How to alias 'CORE', rather than omitting it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env powershell | |
# PowerShell Time to Say Hello | |
& './hello.exe'; # external executable | |
Exit $LastExitCode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Transpilation is required. | |
module Main( main ) where | |
import Prelude( Unit ) as P | |
import Effect( Effect ) as Ef | |
import Effect.Console( log ) as Con | |
-- | PureScript Node Time to Say Hello | |
main:: Ef.Effect P.Unit | |
main = Con.log """Hello, world!""" | |
-- Never fail? | |
-- No tab, seriously? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
r""" Python Time to Say Hello """ | |
import os as OS | |
if ( r'__main__' == __name__ ): | |
try: | |
print( flush = True, *( r'Hello,', r'world!', ) ) | |
except: # intentional catch-all | |
OS._exit( status = OS.EX_IOERR ) # not portable | |
else: | |
pass | |
finally: # reachable only unless _exit | |
pass | |
else: | |
raise IOError( r'Main please!' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Hello | |
{ | |
open Microsoft.Quantum.Intrinsic as Q; | |
open Microsoft.Quantum.Core as Co; | |
/// # Summary | |
/// Q# .NET Time to Say Hello | |
@Co.EntryPoint( ) | |
operation Main( ):Unit | |
{ return Q.Message( "Hello, world!" ); } | |
// Never fail? | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env rscript | |
# R Time to Say Hello | |
R <- base::loadNamespace( package = r'[base]' ); # not recommended | |
if( R$interactive( ) ) | |
{ R$stop( call. = FALSE, r'[Main please!]' ); } else | |
{ | |
u.Q <- function( ... ){ R$quit( save = r'[no]', status = 1 ); }; | |
R$tryCatch( | |
expr = { R$writeLines( text = r'[Hello, world!]' ); }, | |
error = u.Q, | |
warning = u.Q, | |
finally = { R$remove( u.Q ); }, | |
.___. = 0 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# Ruby Time to Say Hello | |
R = Object | |
S = Kernel | |
if ( __FILE__ == $0 ) | |
begin | |
R::STDOUT.puts 'Hello, world!' | |
rescue R::Exception # intentional catch-all | |
S.exit! false | |
end | |
else | |
S.raise 'Main please!' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ring Time to Say Hello | |
Def Main | |
Try | |
Put( 'Hello, world!' + NL ); | |
Catch # intentional catch-all | |
Shutdown( 1 ); | |
End # reachable only unless Shutdown | |
Bye | |
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![ crate_type = "bin" ] | |
#![ crate_name = "hello" ] | |
#![ no_std ] | |
#![ no_implicit_prelude ] | |
extern crate std as S; | |
use S::io as IO; | |
#[ cold ] | |
#[ doc = "Rust Time to Say Hello" ] | |
pub extern "Rust" fn main( ) -> IO::Result< ( ) > | |
{ | |
use IO::{ Write }; | |
return S::writeln!( IO::stdout( ), r#"Hello, world!"# ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.intel_syntax noprefix | |
msg: | |
.string "Hello, world!" | |
# GCC Assembly Time to Say Hello | |
.globl main | |
.type main, @function | |
main: | |
sub rsp, 8 | |
mov edi, OFFSET FLAT:msg | |
call puts | |
add rsp, 8 | |
shr eax, 31 | |
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.{ lang => J }; | |
import scala.{ Predef => P, sys => Sy }; | |
/** Scala Time to Say Hello */ | |
object Main extends scala.App | |
{ | |
try | |
{ P.println( x = """Hello, world!""" ); } // scala.Unit | |
catch // intentional catch-all | |
{ case _:J.Throwable => Sy.exit( status = 1 ); } // scala.Nothing | |
finally // reachable only unless exit | |
{ } | |
} | |
// How to alias 'scala', rather than omitting it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Bash Time to Say Hello | |
'./hello.exe'; # external executable | |
exit $?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[memo] | |
'id' = 31 | |
'name' = 'hello' | |
'message' = 'Hello, world!' | |
'description' = '''Tom's Obvious, Minimal Language Time to Say Hello''' | |
# commentable = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Transpilation is required. | |
/** TypeScript Node Time to Say Hello */ | |
import * as Con from 'console'; | |
import * as Proc from 'process'; | |
if( module === require.main ) | |
try | |
{ Con.log( 'Hello, world!' ); } | |
catch // intentional catch-all | |
{ Proc.exit( 1.0 ); } | |
finally // reachable only unless exit | |
{ } | |
else | |
throw 'Main please!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unlambda Time to Say Hello | |
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` | |
.H.e.l.l.o.,. .w.o.r.l.d.!r r i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --pkg posix | |
namespace Hello | |
{ | |
/** Class for Main Routine */ | |
[ Immutable ] | |
public class World | |
{ | |
/** Vala Time to Say Hello | |
* @return Program Execution Status | |
*/ | |
[ NoThrow ] | |
public static int main( ) | |
{ | |
return | |
( 0 > Posix.stdout.puts( """Hello, world!""" ) )? | |
( Posix.EXIT_FAILURE ): | |
( Posix.EXIT_SUCCESS ); | |
} | |
} | |
} | |
// How to alias 'Posix', rather than omitting it? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports S = System | |
Public Module Program | |
'''<summary> Visual Basic .NET Time to Say Hello </summary> | |
'''<returns> Zero for success, non-zero for failure. </returns> | |
Public Function Main( ) as Integer | |
Try | |
S.Console.WriteLine( value:= "Hello, world!" ) | |
Catch ' intentional catch-all | |
Return 1 | |
Finally | |
End Try | |
Return 0 | |
End Function | |
End Module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env wolframscript | |
(* WolframScript Time to Say Hello *) | |
System`BeginPackage[ "Hello`" ]; | |
System`Module \ | |
[ | |
{ | |
u`ThenElse:= System`Function \ | |
[ { C, T, F }, System`If[ System`TrueQ[ C ], T, F ], System`HoldAll ], | |
u`CatchAll:= System`Function \ | |
[ { X }, System`Catch[ System`Catch[ X, System`Blank[ ] ] ], System`HoldAll ] | |
}, | |
u`ThenElse \ | |
[ | |
( "" === System`$Input ), | |
u`ThenElse \ | |
[ | |
(* intentional catch-all *) | |
( System`Null === u`CatchAll[ System`Print[ "Hello, world!" ] ] ), | |
System`Null, | |
System`Exit[ 1 ] | |
], | |
System`Throw[ "Main please!" ] | |
] | |
]; | |
(* reachable only unless Exit *) | |
System`EndPackage[ ]; | |
(* How to alias 'System', rather than omitting it? *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding='UTF-8' standalone='yes'?> | |
<memo> | |
<id>31</id> | |
<name>hello</name> | |
<message>Hello, world!</message> | |
<description>Extensible Markup Language Time to Say Hello</description> | |
<!-- Caution: These are all strings, natively. --> | |
</memo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
memo: | |
id: 31 | |
name: 'hello' | |
message: 'Hello, world!' | |
description: 'YAML Ain''t Markup Language Time to Say Hello' | |
# No tab, seriously? | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Zig Time to Say Hello | |
pub fn main( ) u8 | |
{ | |
@setCold( true ); | |
@import( "std" ).io.getStdOut( ).outStream( ) | |
.writeAll( "Hello, world!\n" ) catch return 1; return 0; | |
// No tab, seriously? | |
} |
Cautions
When you read these examples, please remind that:
The Good
- They show the program entry and exit, namely the main routine.
- They show how to import a module and rename it.
- They show how an error flows.
The Bad
- They are biased to console application.
- They catch all exceptions <- Be aware of what you are doing.
- They have few chance to show various building elements, blocks, and structures.
The Ugly
- They are enforced to follow my coding style, such as tab indentation and aligned braces.
- They expose language implicit features, thus become verbose.
- This web page is light-themed.
Categories
Tab-Size Preference: { default, 2, 3, 4, 6, 8 }
Power and Responsibility
- Less Abstracted: GCC Assembly / LLVM IR
- Unmanaged Runtime:
- Optionally Managed Runtime: D / Go / Nim
- Managed Runtime:
- Managed by Platform:
- Java Virtual Machine: Groovy / Kotlin / Scala
- .NET: C# / F# / Nemerle / Visual Basic able to invoke Q#
- V8 used by Node: JavaScript transpiled from CoffeeScript / LiveScript / PureScript / TypeScript
- Et Cetera: Fantom
Scripting
- General:
- Scientific: MATLAB / R / WolframScript
- Shell Script: Bash / PowerShell
Et Cetera
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Most examples print Hello, world! to the standard output stream with a new line, and return an exit code to their parent process.