Ctrl+P again to print, arrows/tab to navigate results, enter to confirm

    It's preferred that golfers don't publicly post full solutions to most holes on this site, but the Tutorial hole is an exception. This page aims to share golf knowledge by hosting concise or interesting Tutorial solutions, with explanations where they would be helpful.

    Languages where the current best-known solution is visible on the wiki are marked with 🥇.

    🥇 ><>

    Bytes/Chars 🥇: 42b/42c

    /:?!aoi!
    /aoln0la=?
    /ol?!
    /"!dlroW ,olleH"
    

    Sample code: 286b/286c

    \ printing
    > "!dlroW ,olleH" ooooooooooooo ao 03.
      looping
    > 0 v
        >:nao 1+ :9)?v
    v               ~<
      accessing arguments
    > i : ?!v : 0) ?v ~;
            a
            o       o
            ~
    ^       <       <
    
    Arguments are available via STDIN,
    each argument is NULL terminated.
    x is a no-op.
    
    🥇 05AB1E

    Bytes/Chars 🥇: 28b/14c

    9Ý|«”Ÿ™,‚ï!”š»
    

    Alternate: 28b/14c

    ”Ÿ™,‚ï!”9Ý»|»»
    

    Sample code: 77b/65c

    "Printing"
    ”Ÿ™,‚ï!”,
    
    "Looping"
    9ƒN,}
    
    "Accessing arguments"
    |»,}
    
    ALGOL 68

    Placeholder: 106b/106c (Feel free to replace)

    printf($"Hello, World!"l$);FORiFROM0TO9DOprintf(($g(0)l$,i))OD;FORiFROM2TO99DOprintf(($gl$,a68gargv(i)))OD
    

    Sample code: 193b/193c

    # Printing #
    printf($"Hello, World!"l$);
    
    # Looping #
    FOR i FROM 0 TO 9 DO
        printf(($g(0)l$, i))
    OD;
    
    # Accessing arguments #
    FOR i FROM 2 TO a68g argc DO
        printf(($gl$, a68g argv(i)))
    OD
    
    🥇 APL

    Bytes/Chars 🥇: 59b/42c

    2401⌶1
    ⎕←¨'Hello, World!'0,(⍳9),1↓⍎8⊃⎕NL-3
    

    Sample code: 141b/109c

    ⍝ Printing
    ⎕←'Hello, World!'
    
    ⍝ Looping
    ⎕IO←0
    {⎕←⍵}¨⍳10
    
    ⍝ Accessing arguments
    ⎕←¨1↓2⎕NQ#'GetCommandLineArgs'
    
    Arturo

    Placeholder: 61b/61c (Feel free to replace)

    print"Hello, World!"
    loop 0..9'i->print i
    loop arg'a->print a
    

    Sample code: 123b/123c

    ; Printing
    print "Hello, World!"
    
    ; Looping
    loop 0..9 'i ->
        print i
    
    ; Accessing arguments
    loop arg [a] [
        print a
    ]
    
    🥇 Assembly

    Bytes 🥇: 55b

    .intel_syntax
    
    ; The message is stored in .text (at 0x400000) so we can initialize using "bts esi, 22", saving a byte over "push 0x401000" or similar
    section .text
    msg: db "Hello, World!\n0"
    
    section main, "wax"
    global _start
    _start:
        pop rdi
        pop rdi ; Set 'rsp' to point to 'argv[1]'
        bts esi, 22
    loop:
        cmp byte [rsi], dl ; 'dl' <= 0x01, so if null-byte, replace it with newline
        jge skip
        mov byte [rsi], '\n'
    skip:
        mov al, 1 ; 'rax' is always empty aside from its lowest byte, so we can save bytes here
        mov edi, eax
        mov dl, 1
        syscall
        lodsb ; Used as one-byte "inc rsi", we disregard resulting contents of 'al'
        jge loop ; Flags are preserved from previous 'cmp', so jump to loop if not null
        std
        lodsb
        mov byte [rsi], bl ; Setting/clearing direction flag and decrementing 'rsi' using 'lodsb' takes four bytes
                           ; (same as "sub rsi, 2"), but we save an offset byte here
        lodsb
        cld
        cmp byte [rsi], '9' ; If we've just printed a number (e.g. "0\n"), increment it and print again
        inc byte [rsi]
        jb loop
        pop rsi
        jmp loop
    

    This solution utilizes a few main optimizations described below, as well as micro-optimizations described in comments, and in great detail here.

    As mentioned on the wiki, exiting via segfault directly saves at least six bytes compared to calling exit(), and saves even more as we can disregard 'argc' and loop unconditionally.

    Printing character-by-character directly saves about six bytes compared to calculating string length, and allows for more simple looping logic.

    Storing a single '0' in 'msg' rather than all the digits saves eighteen bytes, and the additional incrementing logic costs thirteen.

    Sample code: 123b

    SYS_WRITE = 1
    SYS_EXIT = 60
    STDOUT_FILENO = 1
    
    # Printing
    .data
    buffer: .string "Hello, World!\n"
    bufferLen = . - buffer
    
    .text
    mov $SYS_WRITE, %eax
    mov $STDOUT_FILENO, %edi
    mov $buffer, %esi
    mov $bufferLen, %edx
    syscall
    
    # Looping
    .data
    digit: .byte   '0', '\n'
    
    .text
    mov $10, %bl
    numberLoop:
        mov $SYS_WRITE, %eax
        mov $STDOUT_FILENO, %edi
        mov $digit, %esi
        mov $2, %edx
        syscall
    
        incb (%rsi)
        dec %bl
        jnz numberLoop
    
    # Accessing arguments
    pop %rbx
    pop %rax
    
    argLoop:
        dec %rbx
        jz endArgLoop
    
        pop %rsi
        mov %rsi, %rdi
    
        mov $-1, %ecx
        xor %al, %al
        repnz scasb
    
        not %ecx
        movb $'\n', -1(%rsi, %rcx)
    
        mov %ecx, %edx
        mov $SYS_WRITE, %eax
        mov $STDOUT_FILENO, %edi
        syscall
    
        jmp argLoop
    endArgLoop:
    
    mov $SYS_EXIT, %eax
    mov $0, %edi
    syscall
    
    🥇 AWK

    Bytes/chars 🥇: 43b/43c

    {for(;i<11;)print i++?i-2:"Hello, World!"}1
    

    Sample code: 439b/439c

    BEGIN {
        # Printing
        print("Hello, World!")
    
        # Looping
        for (i = 0; i < 10; i++) {
            print(i)
        }
    }
    
    # Arguments are available via STDIN in the form of records
    # Each record is NULL terminated
    # By default, AWK automatically performs actions on each record
    {
        # $0 is the full record while $1-$NF accesses individual fields in the record,
        # where NF is the number of fields in the current record
        print($0)
    }
    
    🥇 Bash

    Bytes/chars 🥇: 35b/35c

    history -p Hello,\ World! {0..9} $@
    

    Sample code: 133b/133c

    # Printing
    echo Hello, World!
    
    # Looping
    for i in {0..9}; do
        echo $i;
    done
    
    # Accessing arguments
    for arg; do
        echo $arg;
    done
    
    BASIC

    Placeholder: 80b/80c (Feel free to replace)

    #lang"qb
    ?"Hello, World!
    for i=0to 9
    ?""& i
    next
    for i=1to 100
    ?command$(i)
    next
    

    Sample code: 176b/176c

    ' Printing
    Print "Hello, World!"
    
    ' Looping
    For i As UInteger = 0 To 9
        Print i
    Next
    
    ' Accessing arguments
    For i As Integer = 1 To __FB_ARGC__ - 1
        Print Command(i)
    Next
    
    Befunge

    Bytes/chars 🥈: 40/40c

    a_v,kd"Hello, World!"
    kv>.a,1+::9`
    >#@~,
    

    Sample code: 178b/178c

    v Printing
    > "!dlroW ,olleH" ck, v
    v                   ,a<
    
    v Looping
    > 0 v            <
        >:.a, 1+ :9`!|
    v               $<
    
    v Accessing arguments
    > #@~ :0`!#v_ ,
    ^        ,a<
    
    🥇 Berry

    Bytes/chars 🥇: 56b/56c

    for n:~0..;print(~n?n>9?_argv[n-9]:n:'Hello, World!')end
    

    Sample code: 135b/135c

    # Printing
    print('Hello, World!')
    
    # Looping
    for i : 0 .. 9
        print(i)
    end
    
    # Accessing arguments
    for a : _argv[1..]
        print(a)
    end
    
    🥇 BQN

    Bytes 🥇: 52b/40c

    •Out"Hello, World!"
    •Show¨↕10
    •Out¨•args
    

    Chars 🥇: 55b/38c

    •Out¨"Hello, World!"<⊸∾•args∾˜•Fmt¨↕10
    

    Sample code: 100b/88c

    # Printing
    •Out "Hello, World!"
    
    # Looping
    •Show ¨↕10
    
    # Accessing arguments
    •Out ¨•args
    
    🥇 brainfuck

    Bytes/chars 🥇: 115b/115c

    +[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.+>]-<[-]-<<<-.+++.------.<<-.>>>++>.[--->+>+<<]>[>.<-<<+.>>],[>.<[.,],]
    

    The bulk of this code is for printing "Hello, World!" with convenient leftovers on the tape, making use of (a variation on) this optimal snippet.

    Sample code: 431b/431c

    >>Printing
    +[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+.[<->-]<-.>
    
    >>Looping
    ++++++++[>++++++<-]
    ++++++++++[>.+>++++++++++.[-]<<-]
    
    >>Accessing arguments
    ,[
        [
            .[-],
        ]
        ++++++++++.
        [-],
    ]
    
    Arguments are available via STDIN; each argument is NULL terminated;
    Taking input after EOF leaves the cell unchanged; the tape is circular
    with 65536 cells; and cells are 8 bit with wrapping;
    
    C

    Bytes/Chars: 70b/70c

    c=47;main(n,v)int**v;{main(puts(n?"Hello, World!":++c<58?&c:*++v),v);}
    

    Alternate: 71b/71c

    main(n,x)char**x;{for(++**x;x+=++**x>57;)n=puts(n?"Hello, World!":*x);}
    

    This solution utilizes two facts; None of the provided arguments start with a character that would have a small ascii value under 58. Secondly, the first C argument in every hole is set as string "-" consisting of just a minus sign (ascii 45). It works, as this solution manages to increment the first character three times before printing.

    Alternate: 72b/72c

    i=47;main(c,v)long*v;{for(puts("Hello, World!");;)puts(i++>56?*++v:&i);}
    

    Sample code: 276b/276c

    #include <stdio.h>
    
    int main(int argc, char* argv[]) {
        // Printing
        puts("Hello, World!");
    
        // Looping
        for (int i = 0; i < 10; i++)
            printf("%d\n", i);
    
        // Accessing arguments
        for (int i = 1; i < argc; i++)
            puts(argv[i]);
    
        return 0;
    }
    
    🥇 C#

    Bytes/chars 🥇: 73b/73c

    for(int i=-2;;)Console.WriteLine(++i<0?"Hello, World!":i>9?args[i-10]:i);
    

    Sample code: 372b/372c

    // Printing
    Console.WriteLine("Hello, World!");
    
    // Looping
    for (int i = 0; i < 10; i++)
        Console.WriteLine(i);
    
    // Accessing arguments
    foreach (String arg in args)
        Console.WriteLine(arg);
    
    // Implicit using directives for console applications are enabled.
    // See: https://docs.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates#implicit-using-directives
    
    C++

    Placeholder: 96b/96c (Feel free to replace)

    #import<ios>
    int main(int c,char**v){for(*(*v+=3)=46;v+=++**v>57;)c=puts(c?"Hello, World!":*v);}
    

    Sample code: 410b/410c

    #include <iostream>
    
    int main(int argc, char* argv[]) {
        // Printing
        std::cout<<"Hello, World!"<<std::endl;
    
        // Looping
        for (int i = 0; i < 10; i++)
            std::cout<<i<<std::endl;
    
        // Accessing arguments
        for (int i = 1; i < argc; i++)
            std::cout<<argv[i]<<std::endl;
    
        return 0;
    }
    
    // Code is compiled with clang with -std=c++23
    // See: https://clang.llvm.org/cxx_status.html
    
    🥇 Civet (Bytes only)

    Bytes 🥇: 63b

    (["Hello, World!"]++[0..9]++process.argv[>1]).map console.log .
    

    Sample code: 158b/158c

    // Printing
    console.log 'Hello, World!'
    
    // Looping
    for i of [0..9]
        console.log i
    
    // Accessing arguments
    for arg of process.argv[2..]
        console.log arg
    
    🥇 CJam

    Bytes/chars 🥇: 23b/23c

    "Hello, World!
    "A,ea+N*
    

    Sample code: 82b/82c

    e# Printing
    "Hello, World!"
    
    e# Looping
    T{1_$+}9*]N*N
    
    e# Accessing arguments
    eaN*
    
    🥇 Clojure

    Bytes/chars 🥇: 65b/65c

    (mapv println`("Hello, World!"~@(range 10)~@*command-line-args*))
    

    Sample code: 151b/151c

    ; Printing
    (println "Hello, World!")
    
    ; Looping
    (dotimes [i 10]
      (println i))
    
    ; Accessing arguments
    (doseq [arg *command-line-args*]
      (println arg))
    
    COBOL

    Bytes/chars: 186b/186c

    This program loops infinitely until it encounters an empty argument. Notice that we have to manually clear a on each loop iteration, since accept a from argument-value will simply leave a unmodified once it reaches the end of the argument list.

    program-id.x.data division.local-storage section.
    1 a pic X(99) value"Hello,, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9"procedure division.b.display a
    set a to""accept a from argument-value
    if a>""go b
    

    Sample code: 386b/386c

    program-id.example.
    
    data division.
    local-storage section.
    1 n pic 99 value 0.
    1 i pic 9999.
    1 a pic X(99).
    procedure division.
    
    *> Printing
    display "Hello, World!"
    
    *> Looping
    perform 10 times
    display n(2- function log10(n):)
    add 1 to n
    end-perform.
    
    *> Accessing arguments
    accept i from argument-number
    perform i times
    accept a from argument-value
    display a
    end-perform.
    end-program.
    
    
    🥇 Coconut

    Bytes/chars 🥇: 53b/53c

    *print`map`['Hello, World!';range 10]+os.sys.argv[1:]
    

    Sample code: 158b/158c

    import sys
    
    # Printing
    'Hello, World!' |> print
    
    # Looping
    for i in range(10):
        i |> print
    
    # Accessing arguments
    for arg in sys.argv[1:]:
        arg |> print
    
    🥇 CoffeeScript

    Bytes/chars 🥇: 69b/69c

    console.log ["Hello, World!",...[0..9],...process.argv[2..]].join"\n"
    

    Sample code: 155b/155c

    # Printing
    console.log 'Hello, World!'
    
    # Looping
    for i in [0..9]
        console.log i
    
    # Accessing arguments
    for arg in process.argv[2..]
        console.log arg
    
    🥇 Common Lisp

    Bytes/chars 🥇: 58b/58c

    (format t"Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9~{
    ~a~}"*args*)
    

    Sample code: 176b/176c

    ; Printing
    (write-line "Hello, World!")
    
    ; Looping
    (loop for i from 0 to 9
        do (format t "~d~%" i)
    )
    
    ; Accessing arguments
    (loop for arg in *args*
        do (write-line arg)
    )
    
    🥇 Crystal

    Bytes/chars 🥇: 43b/43c

    Although Crystal is similar to Ruby in many ways, one significant difference is the behavior of puts, which unlike in Ruby, does not automatically flatten its arguments and separate them by newlines.

    puts ["Hello, World!",*0..9,*ARGV].join "
    "
    

    Sample code: 135b/135c

    # Printing
    puts "Hello, World!"
    
    # Looping
    (0..9).each do |i|
        puts i
    end
    
    # Accessing arguments
    ARGV.each do |arg|
        puts arg
    end
    
    🥇 D

    Bytes/chars 🥇: 89b/89c

    import std;void main(string[]a){a[0]="Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9";a.each!writeln;}
    

    Sample code: 252b/252c

    import std.stdio;
    
    void main(string[] argv) {
        // Printing
        writeln("Hello, World!");
    
        // Looping
        foreach (i; 0 .. 10) {
            writeln(i);
        }
    
        // Accessing arguments
        foreach (arg; argv[1 .. $]) {
            writeln(arg);
        }
    }
    
    🥇 Dart

    Bytes/chars 🥇: 65b/65c

    main(a,b){for(b=-2;;)print(++b<0?"Hello, World!":9<b?a[b-10]:b);}
    

    Sample code: 211b/211c

    void main(List<String> argv) {
      // Printing
      print("Hello, World!");
    
      // Looping
      for (var i = 0; i < 10; i++) {
        print(i);
      }
    
      // Accessing arguments
      for (final arg in argv) {
        print(arg);
      }
    }
    
    Egel

    Bytes/chars 🥉: 137b/137c (Feel free to replace)

    import "prelude.eg"using System,List
    def main=print"Hello, World!\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n";map[A->print A"\n"](drop 2 args);print
    

    Sample code: 242b/242c

    import "prelude.eg"
    
    using System, List
    
    def main =
        # Printing
        print "Hello, World!\n";
    
        # Looping
        map [ I -> print I "\n" ] (from_to 0 9);
    
        # Accessing arguments
        map [ ARG -> print ARG "\n" ] (drop 2 args);
    
        print
    
    Elixir

    Placeholder: 69b/69c (Feel free to replace)

    Enum.map ["Hello, World!",0,1,2,3,4,5,6,7,8,9|System.argv],&IO.puts&1
    

    Sample code: 137b/137c

    # Printing
    IO.puts "Hello, World!"
    
    # Looping
    for i <- 0..9, do: IO.puts i
    
    # Accessing arguments
    for arg <- System.argv, do: IO.puts arg
    
    Erlang

    Bytes/chars 🥉: 68b/68c

    main(A)->io:format("Hello, World"++lists:join($
    ,"!0123456789"++A)).
    

    Sample code: 234b/234c

    main(Args) ->
      % Printing
      io:format("Hello, World!~n"),
    
      % Looping
      lists:foreach(fun(N) -> io:format("~p~n", [N]) end, lists:seq(0, 9)),
    
      % Accessing arguments
      lists:foreach(fun(Arg) -> io:format("~ts~n", [Arg]) end, Args).
    
    F#

    Placeholder: 99b/99c (Feel free to replace)

    [<EntryPoint>]let main a=
     printfn"Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9";for b in a do printfn"%s"b
     0
    

    Sample code: 217b/217c

    [<EntryPoint>]
    let main args =
        // Printing
        printfn "Hello, World!"
    
        // Looping
        for i in 0..9 do
            printfn "%d" i
    
        // Accessing arguments
        for arg in args do
            printfn "%s" arg
    
        0
    
    Factor

    Bytes/chars 🥈: 66b/66c (Feel free to replace)

    [I Hello, World!
    I] 0 ..= 9 stack. command-line get [ print ] each
    

    Sample code: 124b/124c

    ! Printing
    "Hello, World!" print
    
    ! Looping
    0 ..= 9 [ . ] each
    
    ! Accessing arguments
    command-line get-global [ print ] each
    
    Fennel

    Bytes/chars 🥉: 80b/80c (Feel free to replace)

    (print"Hello, World!")(for [i 0 9] (print i))(each [i a (ipairs arg)] (print a))
    

    Sample code: 135b/135c

    ;; Printing
    (print "Hello, World!")
    
    ;; Looping
    (for [i 0 9]
      (print i))
    
    ;; Accessing arguments
    (each [i a (ipairs arg)]
      (print a))
    
    🥇 Forth

    Bytes/chars 🥇: 70b/70c

    : x ." Hello, World!"10. do cr i . loop 'e 1 do cr i arg type loop ; x
    

    Sample code: 217b/217c

    \ Printing
    .( Hello, World!) CR
    
    \ Looping
    : looping
        10 0 do i 0 .r cr loop ;
    looping
    
    \ Accessing arguments
    : accessing-arguments
        begin next-arg 2dup d0<> while type CR repeat 2drop ;
    accessing-arguments
    
    bye
    
    Fortran

    Placeholder: 112b/112c (Feel free to replace)

    character*32s
    print"(a)","Hello, World!"
    print"(i0)",[(i,i=0,9)]
    do2 i=1,100
    call getarg(i,s)
    2 print"(a)",s
    end
    

    Sample code: 285b/285c

    integer :: i
    character(len=256) :: arg
    
    ! Printing
    print "(a)", "Hello, World!"
    
    ! Looping
    do i = 0, 9
        print "(i0)", i
    end do
    
    ! Accessing arguments
    ! (NOTE: getarg() and iargc() are GNU Fortran extensions)
    do i = 1, iargc()
        call getarg(i, arg)
        print "(a)", arg
    end do
    
    end
    
    Gleam

    Bytes/chars: 142b/142c (Feel free to replace)

    import gleam/io
    import gleam/list
    pub fn main(){list.map(["Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9",..argv.load().arguments],io.println)}import argv
    

    Sample code: 307b/307c

    import argv
    import gleam/int
    import gleam/io
    import gleam/list
    
    pub fn main() {
      // Printing
      io.println("Hello, World!")
    
      // Looping
      list.range(0, 9)
      |> list.each(fn(i) { io.println(int.to_string(i)) })
    
      // Accessing arguments
      argv.load().arguments
      |> list.each(fn(arg) { io.println(arg) })
    }
    
    Go

    Placeholder: 122b/122c (Feel free to replace)

    package main
    import(.`fmt`
    .`os`)
    func main(){Args[0]=`Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9`
    for _,a:=range Args{Println(a)}}
    

    Sample code: 275b/275c

    package main
    
    import (
        "fmt"
        "os"
    )
    
    func main() {
        // Printing
        fmt.Println("Hello, World!")
    
        // Looping
        for i := range 10 {
            fmt.Println(i)
        }
    
        // Accessing arguments
        for _, arg := range os.Args[1:] {
            fmt.Println(arg)
        }
    }
    
    🥇 GolfScript

    Bytes/chars 🥇: 23b/23c

    "Hello, World!
    "10,@+n*
    

    Sample code: 121b/121c

    # Printing
    "Hello, World!"puts
    
    # Looping
    10,{p}/
    
    # The stack is initialized with one element, an array of arguments:
    n*
    
    Groovy

    Placeholder: 70b/70c (Feel free to replace)

    println"Hello, World!"
    for(i in 0..9)println i
    for(a in args)println a
    

    Sample code: 135b/135c

    // Printing
    println "Hello, World!"
    
    // Looping
    for (i in 0..9)
        println i
    
    // Accessing arguments
    for (arg in args)
        println arg
    
    Harbour

    Bytes/chars 🥈: 94b/94c (Feel free to replace)

    LOCAL i
    ??"Hello, World!"
    FOR i:=0TO 9
    ?hb_ntos(i)
    NEXT
    FOR i:=1TO PCount()
    ?hb_PValue(i)
    NEXT
    

    Sample code: 164b/164c

    LOCAL i
    
    // Printing
    ?? "Hello, World!"
    
    // Looping
    FOR i := 0 TO 9
        ? hb_ntos( i )
    NEXT
    
    // Accessing arguments
    FOR i := 1 TO PCount()
        ? hb_PValue( i )
    NEXT
    
    Hare

    Placeholder: 151b/151c (Feel free to replace)

    use fmt;use os;export fn main()void={fmt::println("Hello, World!")!;for(let i=0;i<10;i+=1)fmt::println(i)!;for(let a..os::args[1..])fmt::println(a)!;};
    

    Sample code: 267b/267c

    use fmt;
    use os;
    
    export fn main() void = {
        // Printing
        fmt::println("Hello, World!")!;
    
        // Looping
        for (let i = 0; i < 10; i += 1)
            fmt::println(i)!;
    
        // Accessing arguments
        for (let arg .. os::args[1..])
            fmt::println(arg)!;
    };
    
    🥇 Haskell

    Bytes/chars 🥇: 94b/94c

    import System.Environment
    main=do _:a<-getArgs;mapM putStrLn$"Hello, World!":map show[0..9]++a
    

    Sample code: 187b/187c

    import System.Environment
    
    main = do
      -- Printing
      putStrLn "Hello, World!"
    
      -- Looping
      mapM print [0..9]
    
      -- Accessing arguments
      args <- drop 1 <$> getArgs
      mapM putStrLn args
    
    🥇 Haxe

    Bytes/chars 🥇: 82b/82c

    var main=()->Sys.print("Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    "+Sys.args().join("
    "));
    

    Uses module-level fields, which are undocumented.

    Sample code: 282b/282c

    class Main {
        static public function main() {
            // Printing
            Sys.println("Hello, World!");
    
            // Looping
            for (i in 0...10)
                Sys.println(i);
    
            // Accessing arguments
            for (arg in Sys.args())
                Sys.println(arg);
        }
    }
    
    🥇 Hexagony

    Bytes/chars 🥇: 63b/63c

    (Explanation to be written at some point)

    1*H;1Po;o..Q2&(}:</,"'x&)'/>=_;{!)'-<.'>e;dl;l;=.\0;WP0$;|_\r=;
    

    Sample code: 650b/650c

              \ P r i n t i n g .
             \ H ; e ; l ; ; o ; \
            / o ; W ; 0 P ; 2 Q < .
           . > ; r ; l ; d ; P 1 ; \
          > * . . . . . . . . . . < .
         . . . . . . . . . . . . . . .
        . . L o o p i n g . . . . . . .
       \ 1 0 ; " $ / } ! ) " ; \ . . . .
      . . . . . . . > . - " = < . . . . .
     . / . . . . . < . . . . . . . . . . .
      . . . . . . . . . . . . . . . . . .
       . . . A c c e s s i n g . . . . .
        . . . A r g u m e n t s . . . .
         . . . . . . > \ . @ . . . . .
          . > $ > , < \ ) < . . . . .
           . . \ . ; / $ 0 / . . . .
            . A r g u m e n t s . .
             . a r e . N U L L . .
              t e r m i n a t e d
    
    Hush

    Bytes/chars 🥈: 118b/118c (Feel free to replace)

    std.print("Hello, World!")for i in std.range(0,10,1)do
    std.print(i)end
    for a in std.iter(std.args())do
    std.print(a)end
    

    Sample code: 182b/182c

    # Printing
    std.print("Hello, World!")
    
    # Looping
    for i in std.range(0, 10, 1) do
        std.print(i)
    end
    
    # Accessing arguments
    for arg in std.iter(std.args()) do
        std.print(arg)
    end
    
    🥇 Hy

    Bytes/chars 🥇: 61b/61c

    (py "*map(print,['Hello, World!',*range(10)]+sys.argv[1:]),")
    

    Simply the Python 🥇 executed from a string. This pattern is very often optimal in Hy, so perhaps it ought to be removed to keep the language interesting...

    Sample code: 161b/161c

    ; Printing
    (print "Hello, World!")
    
    ; Looping
    (for [i (range 10)]
        (print i))
    
    ; Accessing arguments
    (for [arg (get sys.argv (slice 1 None))]
        (print arg))
    
    🥇 iogii

    Bytes/chars 🥇: 20b/20c (Feel free to replace)

    "Hello, World!
    "10T$
    

    Sample code: 68b/68c

    # Printing
    "Hello, World!\n"
    
    # Looping
    10T
    
    # Accessing arguments
    $
    
    J

    Bytes/chars 🥈: 37b/37c

    echo&>0 1}&ARGV'Hello, World!';i.10 1
    

    Sample code: 97b/97c

    NB.Printing
    echo'Hello, World!'
    
    NB.Looping
    echo i.10 1
    
    NB.Accessing arguments
    echo each 2}.ARGV
    
    🥇 Janet

    Bytes/chars 🥇: 58b/58c

    Compare to the more straightforward 59b/59c solution below. Instead of dropping the first argument, we can replace it with 9. That allows us to use (range 9) instead of (range 10), saving one byte.

    (map print["Hello, World!";(range 9);(put(dyn :args)0 9)])
    

    Bytes/chars 🥈: 59b/59c

    (map print["Hello, World!";(range 10);(drop 1(dyn :args))])
    

    Alternate 59b/59c which skips the first argument in a cleverer way, but ends up being the same length:

    (|(map print["Hello, World!";(range 10)$1;$&]);(dyn :args))
    

    Sample code: 146b/146c

    # Printing
    (print "Hello, World!")
    
    # Looping
    (for i 0 10
      (print i))
    
    # Accessing arguments
    (each arg (tuple/slice (dyn :args) 1)
      (print arg))
    
    🥇 Java

    Bytes/chars 🥇: 113b/113c (Feel free to replace)

    interface ${static void main(String[]a){for(int i=-2;;)System.out.println(++i<0?"Hello, World!":i>9?a[i-10]:i);}}
    

    Sample code: 323b/323c

    class Main {
        public static void main(String[] args) {
            // Printing
            System.out.println("Hello, World!");
    
            // Looping
            for (int i = 0; i < 10; i++)
                System.out.println(i);
    
            // Accessing arguments
            for (String arg : args)
                System.out.println(arg);
        }
    }
    
    🥇 JavaScript

    Bytes/chars 🥇: 61b/61c

    There are (at least) three 61b solutions by hardcoding the numbers 0-9.

    print(`Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    `+arguments.join`
    `)
    

    Alternatively, the spread syntax can be used to create the digits 0-9:

    print(["Hello, World!",..."0123456789",...arguments].join`
    `)
    

    This variation abuses the mechanics of tagged templates:

    print`Hello${[,..."0123456789",...arguments].join`
    `} World!`
    

    Without hardcoding: 64b/64c

    for(i=~(p=print)`Hello, World!`;i++<9;)p(i);p(arguments.join`
    `)
    

    There are two tricks worth noting: First, this solution assigns the print function to a variable, which saves bytes when there are more than 2 prints. Second, it uses the return value of print to initialize the loop counter, saving a byte.

    Without hardcoding, single expression: 65b/65c

    print(["Hello, World!",...Array(10).keys(),...arguments].join`
    `)
    

    Sample code: 157b/157c

    // Printing
    print("Hello, World!");
    
    // Looping
    for (let i = 0; i < 10; i++)
        print(i);
    
    // Accessing arguments
    for (let arg of arguments)
        print(arg);
    
    🥇 jq

    Bytes/chars 🥇: 35b/35c

    "Hello, World!",range(10),$ARGS[][]
    

    Sample code: 91b/91c

    # Printing
    "Hello, World!",
    
    # Looping
    range(10),
    
    # Accessing arguments
    $ARGS.positional[]
    
    🥇 Julia

    Bytes/chars 🥇 36b/36c

    println.(["Hello, World!";0:9;ARGS])
    

    Sample code: 135b/135c

    # Printing
    println("Hello, World!")
    
    # Looping
    for i=0:9
        println(i)
    end
    
    # Accessing arguments
    for arg in ARGS
        println(arg)
    end
    
    🥇 K

    Bytes/chars 🥇: 28b/28c (Feel free to replace)

    `0:($`"Hello, World!",!10),x
    

    Sample code: 73b/73c

    /Printing
    `0:"Hello, World!"
    
    /Looping
    `0:$!10
    
    /Accessing arguments
    `0:x
    
    🥇 Kotlin

    Bytes/chars 🥇: 50b/50c

    ((0..9)+args).fold("Hello, World!"){s,x->s+"\n$x"}
    

    Sample code: 71b/71c

    print("""Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    """+args.joinToString("\n"))
    

    Sample code: 138b/138c

    // Printing
    println("Hello, World!")
    
    // Looping
    for (i in 0..9)
        println(i)
    
    // Accessing arguments
    for (arg in args)
        println(arg)
    
    🥇 Lua

    Bytes/Chars 🥇: 67b/67c

    print'Hello, World!'for i=-9,#arg do
    print(i>0 and arg[i]or 9+i)end
    

    Bytes/Chars 🥇: 67b/67c

    print(table.concat({"Hello, World!",0,1,2,3,4,5,6,7,8,9,...},"\n"))
    

    Sample code: 144b/144c

    -- Printing
    print("Hello, World!")
    
    -- Looping
    for i = 0, 9 do
        print(i)
    end
    
    -- Accessing arguments
    for i = 1, #arg do
        print(arg[i])
    end
    
    🥇 Nim

    Bytes/Chars 🥇: 76b/76c

    import os
    echo"Hello, World!"
    for i in..99:echo if i>9:paramstr i-9 else: $i
    

    Note: This has a chance to fail; the 99 has to be replaced with 109 for it to work 100% of the time, at the cost of 1 byte.

    Sample code: 149b/149c

    import os
    
    # Printing
    echo "Hello, World!"
    
    # Looping
    for i in 0 .. 9:
        echo i
    
    # Accessing arguments
    for arg in commandLineParams():
        echo arg
    
    OCaml

    Bytes/chars: 80b/80c

    Sys.(argv.(0)<-"Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9";Array.map print_endline argv)
    

    Sample code: 207b/207c

    (* Printing *)
    print_endline "Hello, World!";
    
    (* Looping *)
    for i = 0 to 9 do
      Printf.printf "%d\n" i
    done;
    
    (* Accessing arguments *)
    Sys.argv
      |> Array.to_list
      |> List.tl
      |> List.iter print_endline;
    
    Odin

    Placeholder: 160b/160c (Feel free to replace)

    package main
    import"core:fmt"
    import"core:os"
    main::proc(){fmt.println("Hello, World!")
    for i in 0..<10{fmt.println(i)}for arg in os.args[1:]{fmt.println(arg)}}
    

    Sample code: 272b/272c

    package main
    
    import "core:fmt"
    import "core:os"
    
    main :: proc() {
        // Printing
        fmt.println("Hello, World!")
    
        // Looping
        for i in 0..<10 {
            fmt.println(i)
        }
    
        // Accessing arguments
        for arg in os.args[1:] {
            fmt.println(arg)
        }
    }
    
    🥇 Pascal

    Bytes/chars 🥇: 107b/107c

    var i:word;begin
    write('Hello, World!'^j);for i:=0to 9do writeLn(i);for i:=1to argc do writeLn(argv[i])end.
    

    Sample code: 222b/222c

    var
        i: integer;
    begin
        { Printing }
        writeLn('Hello, World!');
    
        { Looping }
        for i := 0 to 9 do
            writeLn(i);
    
        { Accessing arguments }
        for i := 1 to argc - 1 do
            writeLn(argv[i]);
    end.
    
    🥇 Perl

    Bytes/chars 🥇: 33b/33c

    say for'Hello, World!',0..9,@ARGV
    

    Sample code: 153b/153c

    # Printing
    say 'Hello, World!';
    
    # Looping
    say for 0..9;
    
    # Accessing arguments
    say for @ARGV;
    
    # Code is run under -E, all current features are enabled.
    
    🥇 PHP

    Placeholder: 56/56c (Feel free to replace)

    ?>Hello, World!<?for(;;)echo'
    ',$i>9?~~$argv[++$j]:+$i++
    

    Alternative solution: 56b/56c

    echo join("
    ",[~9=>'Hello, World!',...range(0,9)]+$argv)
    

    Sample code: 168b/168c

    # Printing
    echo "Hello, World!\n";
    
    # Looping
    for ($i = 0; $i < 10; $i++)
        echo "$i\n";
    
    # Accessing arguments
    for ($i = 1; $i < $argc; $i++)
        echo "$argv[$i]\n";
    
    Picat

    Placeholder: 83b/83c (Feel free to replace)

    main(B)=>print("Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    "),foreach (A in B)println(A)end.
    

    Sample code: 329b/329c

    main =>
        % Printing
        println("Hello, World!"),
    
        % Looping
        foreach (I in 0..9)
            println(I)
        end.
    
    main(Args) =>
        % Printing
        println("Hello, World!"),
    
        % Looping
        foreach (I in 0..9)
            println(I)
        end,
    
        % Accessing arguments
        foreach (Arg in Args)
            println(Arg)
        end.
    
    🥇 PowerShell

    Bytes/chars 🥇: 26b/26c

    Implicit output makes this one pretty simple. Note that implicit output is disabled on the Quine hole specifically, to keep it more interesting.

    'Hello, World!'
    0..9
    $args
    

    Sample code: 162b/162c

    # Printing
    Write-Host 'Hello, World!'
    
    # Looping
    ForEach ($i in 0..9) {
        Write-Host $i
    }
    
    # Accessing arguments
    ForEach ($arg in $args) {
        Write-Host $arg
    }
    
    Prolog

    Bytes/chars: 75b/75c

    :-cmdline(A),maplist(writeln,['Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8',9|A]).
    

    Sample code: 179b/179c

    % Printing
    :- writeln("Hello, World!").
    
    % Looping
    :- numlist(0, 9, List),
       maplist(writeln, List).
    
    % Accessing arguments
    :- prolog_flag(argv, Args),
       maplist(writeln, Args).
    
    🥇 Python

    Bytes 🥇: 65b/65c

    import sys
    *map(print,["Hello, World!",*range(10)]+sys.argv[1:]),
    

    Chars 🥇: 124b/58c

    Check out the "Packers" section of the Python wiki page to see how this was generated from the bytes gold.

    exec(bytes("浩潰瑲猠獹⨊慭⡰牰湩ⱴ≛效汬Ɐ圠牯摬∡⨬慲杮⡥〱崩猫獹愮杲孶㨱⥝‬","u16")[2:])
    

    Sample code: 152b/152c

    import sys
    
    # Printing
    print('Hello, World!')
    
    # Looping
    for i in range(10):
        print(i)
    
    # Accessing arguments
    for arg in sys.argv[1:]:
        print(arg)
    
    🥇 Qore

    Bytes/chars 🥇: 45b/45c

    print(join("
    ","Hello, World!"+(0..9)+ARGV));
    

    Sample code: 171b/171c

    # Printing
    print("Hello, World!\n");
    
    # Looping
    foreach int i in (0..9)
        printf("%d\n", i);
    
    # Accessing arguments
    foreach string arg in (ARGV)
        printf("%s\n", arg);
    
    🥇 R

    Bytes/chars 🥇: 46b/46c

    write(c("Hello, World!",0:9,commandArgs(T)),1)
    

    Sample code: 158b/158c

    # Printing
    write("Hello, World!", 1)
    
    # Looping
    for (i in 0:9) {
        write(i, 1)
    }
    
    # Accessing arguments
    for (arg in commandArgs(TRUE)) {
        write(arg, 1)
    }
    
    🥇 Racket

    Bytes/chars 🥇: 72b/72c

    (command-line #:args a(map displayln`("Hello, World!",@(range 10),@a))x)
    

    The x can be any undefined variable name. It causes an error, which prevents the implicit output of the map result.

    Raku

    Bytes/chars: 34b/33c

    ("Hello, World!",^10,@*ARGS)».say
    

    Sample code: 96b/96c

    # Printing
    say 'Hello, World!';
    
    # Looping
    .say for ^10;
    
    # Accessing arguments
    .say for @*ARGS;
    
    Rebol

    Bytes/chars 🥈: 78b/78c (Feel free to replace)

    print"Hello, World!"for i 0 9 1[print i]foreach a system/options/args[print a]
    

    Sample code: 144b/144c

    ; Printing
    print "Hello, World!"
    
    ; Looping
    for i 0 9 1 [
        print i
    ]
    
    ; Accessing arguments
    foreach arg system/options/args [
        print arg
    ]
    
    (*) Rexx

    Bytes/chars (*): 69b/69c

    say"Hello, World!"
    do i=0 to 9
    say i
    end
    do i=1 to 100
    say arg(i)
    end
    

    (*) The 🥇 is this with 100 replaced by 99, which causes a tiny chance of failure.

    Sample code: 132b/132c

    -- Printing
    say "Hello, World!"
    
    -- Looping
    do i = 0 to 9
        say i
    end
    
    -- Accessing arguments
    do i = 1 to arg()
        say arg(i)
    end
    
    🥇 Rockstar

    Bytes/chars 🥇: 53b/53c

    join i with "
    "say "Hello, World"+"!0123456789"*"
    "+i
    

    Sample code: 129b/129c

    (Printing)
    print "Hello, World!"
    
    (Looping)
    for x in 10
      print x
    end
    
    (Accessing arguments)
    for arg in arguments
      print arg
    end
    
    🥇 Ruby

    Bytes/chars 🥇: 28b/28c

    puts'Hello, World!',*0..9,$*
    

    Sample code: 135b/135c

    # Printing
    puts 'Hello, World!'
    
    # Looping
    (0..9).each do |i|
        puts i
    end
    
    # Accessing arguments
    ARGV.each do |arg|
        puts arg
    end
    
    Rust

    Bytes/chars 🥈: 103b/103c

    fn main(){print!{"Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9"}for a in std::env::args().skip(1){print!("
    {a}")}}
    

    Sample code: 231b/231c

    fn main() {
        // Printing
        println!("Hello, World!");
    
        // Looping
        for i in 0..10 {
            println!("{i}");
        }
    
        // Accessing arguments
        for arg in std::env::args().skip(1) {
            println!("{arg}");
        }
    }
    
    🥇 Scala

    Bytes/chars 🥇: 43b/43c

    "Hello, World!"+:(0.to(9)++args)map println
    

    Sample code: 127b/127c

    // Printing
    println("Hello, World!")
    
    // Looping
    for (i <- 0 to 9)
        println(i)
    
    // Accessing arguments
    args.foreach(println)
    
    🥇 Scheme

    Bytes/chars 🥇: 63b/63c

    (printf"Hello, World!~@{~{
    ~a~}~}"(iota 10)(cdr(command-line)))
    

    Sample code: 207b/207c

    ; Printing
    (printf "~a~n" "Hello, World!")
    
    ; Looping
    (for-each (lambda (i) (display i) (newline)) (iota 10))
    
    ; Accessing arguments
    (for-each (lambda (arg) (display arg) (newline)) (command-line-arguments))
    
    (*) sed

    Bytes/chars (*): 44b/44c

    1s/^/Hello, World!0123456789/
    s/[!0-9]/&\n/g
    

    (*): This is the shortest solution with 100% pass rate so far, but it's not 🥇.

    Sample code: 330b/330c

    # Printing
    1i Hello, World!
    
    # Looping
    2,$ b
    
    h
    s/.*/0/
    :loop
    p
    y/012345678/123456789/
    /9/ !b loop
    G
    
    # Accessing arguments
    # (... automatic, one per line ...)
    
    # Arguments are available via STDIN,
    # each argument is separated with a null byte.
    # The code is run with -E and -z options.
    # Output replaces null bytes with newlines.
    
    🥇 SQL

    Bytes/chars 🥇: 58b/58c

    SELECT'Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9';SELECT*FROM argv
    
    🥇 Squirrel

    Bytes/chars 🥇: 65b/65c

    for(x<--2;;)print((++x<0?"Hello, World!":9<x?vargv[x-10]:x)+"\n")
    

    Sample code: 173b/173c

    // Printing
    print("Hello, World!\n");
    
    // Looping
    for (local i = 0; i < 10; i++)
        printf("%d\n", i);
    
    // Accessing arguments
    foreach (arg in vargv)
        print(arg + "\n");
    
    🥇 Stax

    Bytes 🥇: 17b/17c

    ArrE`jaH1"jS3!`Lm
    

    Chars 🥇: 37b/15c

    Written in PackedStax, which can be easily generated using the online interpreter.

    Ç¿∟↔ä♦Tδα₧▄↨♪▓ä
    

    Sample code: 76b/76c

    `Printing`d
    "Hello, World!"P
    
    `Looping`d
    0P9R{P}F
    
    `Accessing arguments`d
    Lm
    
    🥇 Swift

    Bytes/chars 🥇: 88b/88c

    (["Hello, World!"]+(0...9).map{"\($0)"}+CommandLine.arguments[1...]).map{print($0)}
    

    Sample code: 160b/160c

    // Printing
    print("Hello, World!")
    
    // Looping
    for i in 0...9 {
        print(i)
    }
    
    // Accessing arguments
    for arg in CommandLine.arguments[1...] {
        print(arg)
    }
    
    🥇 Tcl

    Bytes/chars 🥇: 47b/47c

    puts Hello,\ World!\n[join [lseq 10]\ $argv \n]
    

    Sample code: 150b/150c

    # Printing
    puts "Hello, World!"
    
    # Looping
    for {set x 0} {$x < 10} {incr x} {
        puts $x
    }
    
    # Accessing arguments
    foreach arg $argv {
        puts $arg
    }
    
    🥇 TeX

    Bytes/chars 🥇: 80b/80c

    \let\eject
    Hello, World!0123456789\count0 0\def~{\argv{\count0}~ }~
    

    Sample code: 218b/218c

    % Printing
    Hello, World!
    
    % Looping
    \newcount\i
    \loop\ifnum\i<10
        \the\i\endgraf
        \advance\i by1
    \repeat
    
    % Accessing arguments
    \newcount\j
    \loop\ifnum\j<\argc\relax
        \argv\j\endgraf
        \advance\j by1
    \repeat
    
    🥇 Uiua

    Bytes/chars 🥇: 39b/31c

    ≡&p⊂⇡10↘1&args&p"Hello, World!"
    

    Sample code: 88b/80c

    # Printing
    &p"Hello, World!"
    
    # Looping
    ≡&p⇡10
    
    # Accessing arguments
    ≡&p↘1&args
    
    V

    Bytes/chars 🥈: 70b/70c (Feel free to replace)

    print('Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    '+arguments()[1..].join('
    '))
    

    Sample code: 162b/162c

    import os
    
    // Printing
    println('Hello, World!')
    
    // Looping
    for i in 0..10 {
        println(i)
    }
    
    // Accessing arguments
    for arg in os.args[1..] {
        println(arg)
    }
    
    🥇 Vala

    Bytes/chars 🥇: 101b/101c

    void main(string[]A){print("Hello, World!
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9");foreach(var a in A[1:])print("
    "+a);}
    
    🥇 VimL

    Bytes/chars 🥇: 37b/37c

    i
    Hello, World!
    .
    pu=range(10)+args
    w
    

    Alt: 37b/37c

    norm"=rang<C-A>10)+args<CR>POHello, World!
    x
    

    Sample code: 175b/175c

    " Printing
    i
    Hello, World!
    .
    
    " Looping
    for i in range(10)
        pu=i
    endfo
    
    " Accessing arguments
    for a in args
        pu=a
    endfo
    
    " Make sure to save the file when you're done!
    w
    
    🥇 Vyxal

    Bytes/chars 🥇: 12b/10c

    kH9ʁJ#?J¨,
    

    Sample code: 80b/79c

    ## Printing
    "Hello, World!",
    
    ## Looping
    9ʁ (n,}
    
    ## Accessing arguments
    #? (,}
    
    🥇 Wren

    Bytes/chars 🥇: 87b/87c

    import"os"for Process as p
    for(a in["Hello, World!"]+(0..9)+p.arguments)System.print(a)
    

    Sample code: 179b/179c

    import "os" for Process
    
    // Printing
    System.print("Hello, World!")
    
    // Looping
    for (i in 0..9) System.print(i)
    
    // Accessing arguments
    for (a in Process.arguments) System.print(a)
    
    Zig

    Bytes/chars 🥉: 181b/181c (Feel free to replace)

    const s=@import("std");pub fn main()void{for(s.os.argv[1..],1..)|a,b|_=&s.io.getStdOut().writer().print("{s}{s}\n",.{"Hello, World!\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n"[0..1/b*34],a});}
    

    Sample code: 343b/343c

    const std = @import("std");
    
    pub fn main() !void {
        const stdout = std.io.getStdOut().writer();
    
        // Printing
        try stdout.print("Hello, World!\n", .{});
    
        // Looping
        for (0..10) |i|
            try stdout.print("{}\n", .{i});
    
        // Accessing arguments
        for (std.os.argv[1..]) |arg|
            try stdout.print("{s}\n", .{arg});
    }