Execute code of arbitrary languages!
Use C-c C-c
on any #+begin_src
or #+end_src
line.
Anyone wanna see something cool?
BEGIN { print "Hello from Awk."; }
echo "Hello from Bash."
int main() {
printf("Hello from C.");
return 0;
}
#include<iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
using System;
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello from C#.");
}
}
using System;
class OutExample {
static void Adder(int a, int b, out int result) {
result = a + b;
}
static void Main() {
var a = 5;
var b = 10;
int result;
Adder(a, b, out result);
Console.WriteLine($"r = {result}");
}
}
import std.stdio;
void main()
{
writeln("Hello from D!");
}
(message "Hello from Elisp.")
printfn "Hello from F#."
program hello
print *, "Hello from Fortran."
end program
fmt.Println("Hello from Go.")
console.log("Hello from Javascript.");
print("Hello from Lua.")
These examples are all for linux 64 bit.
global main
extern write, exit
section .rodata
msg: db "Hello from NASM.", 13
msglen: equ $ - msg
section .text
main:
mov rdi, 1 ; STDOUT_FILENO
mov rsi, msg ; "Hello from NASM.",
mov rdx, msglen ; sizeof("Hello from NASM.")
call write
mov rdi, 0 ; EXIT_SUCCESS
call exit
global main
extern putchar
section .text
putstar:
mov rdi, '*'
call putchar
ret
putbreak:
mov rdi, 10
call putchar
ret
main:
mov rbx, 1 ; outer loop counter
outerloop:
mov rcx, rbx ; inner loop counter
innerloop:
push rcx
push rbx
call putstar
pop rbx
pop rcx
dec rcx
jrcxz innerdone
jmp innerloop
innerdone:
call putbreak
inc rbx
cmp rbx, 6
jne outerloop
ret
print_string "Hello from OCaml.\n"
print("Hello from Perl.");
print("Hello from Python.")
print("Hello from R.")
puts "Hello from Ruby."
println!("Hello from Rust.");
(begin (display "Hello from Scheme.")
(newline))
(with-temp-buffer
(insert out)
(beginning-of-buffer)
(search-forward "val it :")
(beginning-of-line)
(call-interactively 'set-mark-command)
(end-of-buffer)
(call-interactively 'kill-region)
(buffer-string))
(s-chop-prefix "[1] " out)