*

From Esolang
Jump to: navigation, search

* is a very simple esoteric programming language, where the only commands consist of *, space, and + (if you can even count that one).

  • * prints "Hello World".
  • [SPACE]*[SPACE] ([SPACE] is the space character.) prints a random number between 0 and 1 multiplied by an extremely big number. (In the Java interpreter, it's the biggest number possible in Java, 2,147,483,647.)
  • *+* runs forever.

Examples

Hello World

*

Random Number Generator between 0 and 2,147,483,647

 *

Infinite Loop

*+*

Interpreters

Java

import java.util.Scanner;

public class Asterisk{
  
  public static void main(String[] args){
  
    Scanner in = new Scanner(System.in);
    System.out.println();
    String ast = in.nextLine();
    
    if(ast == "*") System.out.println("Hello World");
    else if(ast == " * ") System.out.println((Math.random() * Integer.MAX_VALUE));
    else if(ast == "*+*") recur();
  }
  public static void recur(){ recur(); }
}

JavaScript

var code=prompt();
if(code === "*") console.log("Hello World");
if(code === " * ") console.log(Math.random() * Number.MAX_VALUE);
if(code === "*+*") while(true){}

Python 3

from random import random
def ast():
    while True:
        cmd = input('*> ')
        if cmd == '*': print('Hello World')
        elif cmd == ' * ': print(random() * 2147483647)
        elif cmd == '*+*':
            while True: pass