Hello world! Examples of different languages

Re: Hello world! Examples of different languages

Sed





s/.*/Hello, world!/
q



Re: Hello world! Examples of different languages

:smiley:

copy ekumunng


[fd@localhost ~]$ cat helloEK.c

main()
{
    printf("Hello World
");


}

compile:



[fd@localhost ~]$ gcc -o helloEK helloEK.c
   

check:


[fd@localhost ~]$ ./helloEK
Hello World

convert to assembly:


[fd@localhost ~]$ gcc -S  helloEK.c



[fd@localhost ~]$ cat helloEK.s
    .file    "helloEK.c"
    .section    .rodata
.LC0:
    .string    "Hello World"
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    pushl    %ebp
    .cfi_def_cfa_offset 8
    .cfi_offset 5, -8
    movl    %esp, %ebp
    .cfi_def_cfa_register 5
    andl    $-16, %esp
    subl    $16, %esp
    movl    $.LC0, (%esp)
    call    puts
    leave
    .cfi_restore 5
    .cfi_def_cfa 4, 4
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .ident    "GCC: (GNU) 4.8.2 20131212 (Red Hat 4.8.2-7)"
    .section    .note.GNU-stack,"",@progbits
[fd@localhost ~]$

assembly :halo:

Re: Hello world! Examples of different languages

Naturally, it follows, awk:



 awk "BEGIN {print \"Hello World\"}"

Re: Hello world! Examples of different languages

^Yep.

VB.NET



Module Module1
    Sub Main() 
        Console.WriteLine("Hello, world!")
    End Sub
End Module

'non-console example:
Class Form1
    Public Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load()
        MsgBox("Hello, world!")
    End Sub
End Class


Re: Hello world! Examples of different languages

Void should be lower case, so that wouldn't compile.

Re: Hello world! Examples of different languages

^ I knew there was some mistake :bummer:

Re: Hello world! Examples of different languages

No worries though…I remember spending hours trying to compile my pascal code. Now that was a bummer.

Re: Hello world! Examples of different languages

I don't mean to pick on you, but for it to show up on the page you would have to put it in the body tag:



Hello World.

Re: Hello world! Examples of different languages

Perl 5





use v5.10;
say 'Hello, world!';



Re: Hello world! Examples of different languages

I’m a bit rusty I suppose :bummer:
Thanks for the correction :hat:

Re: Hello world! Examples of different languages

I have had my blunders while compiling ages ago :hehe:

Re: Hello world! Examples of different languages

delphi




program HelloWorld;
begin
  Writeln('Hello, world!');
end.


Delphi (software) - Wikipedia and Object Pascal - Wikipedia