• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Fun activity Say hello... in a coding language!

Nous

Coder
C++:
#include <iostream>
using namespace std;

int main() {
    cout << "Hello World" << endl;
    return 0;
}

:alien:
 

Ghost

King Coder
I wrote a function that can take a command "s" and interpret anything after it as an echo.
It could obviously be expanded to allow other shorthand code...

[CODE lang="php" title="fakephp code sample (echo shorthand for php)"]<?php

function fakephp($string){
$endofline = "<br>"; // use PHP_EOL for console / server outputs
//echo "the string is".$string;
$lines = explode( "\n",$string);
//print_r($lines);
$linemax = count($lines);
$linecount = 0;
foreach($lines as $line){
if(strpos($line, "s ") === 0){
$sayvalue = str_replace("s ", "", $line);
$endsay = $linecount < $linemax-1 ? $endofline : "";
echo $sayvalue . $endsay;
}
$linecount++;
}
}

$code = "s Hello!
s How are you?";

fakephp($code);

?>[/CODE]

This was kind of fun to write, so I actually expanded upon this idea and started a github project:

I use a class file (FakePHP.php) and you can run the code by using index.php

I will add other commands to it in the future, but for now it just handles echos, linebreaks, and simple strings.

I also included the ability to send code blocks in an array so that multiple bits of code can be processed in one "run" function.
 
Last edited:

Ash

King Coder
C++:
#include <iostream>


using namespace std;

int main() {

cout << "Hello everyone";

return 0;

}
 

Ghost

King Coder
HTML:
<span>Hello Ash!</span>
Code:
C     Fortran

      PROGRAM HELLO
      WRITE (*,100)
      STOP
  100 FORMAT (' Hello Malcolm! ' /)
      END
~ courtesy of: http://helloworldcollection.de/#Fortran

The hello world collection is pretty cool. They currently have 603 versions of Hello World, all different programming languages, and 78 human languages supported too.

Fortran is the oldest programming language (still in use), according to many.

There's a lot of cool things on this site. For example, here's a language that's used for the Medal of Honor game:
Code:
// Hello World in the Medal of Honor Allied Assault scripting language

iprintln "Hello World!"
 

Arthur

New Coder
C:
#include <stdio.h>

int main () {
   int message[] = {72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33};
   int limit = sizeof (message) / sizeof (message[0]);
   int loop;
   for (loop = 0; loop < limit; loop++) {
      printf("%c", message[loop]);
   }
   printf("\n");
  
   return 0;
}
 

Ghost

King Coder
C:
#include <stdio.h>

int main () {
   int message[] = {72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33};
   int limit = sizeof (message) / sizeof (message[0]);
   int loop;
   for (loop = 0; loop < limit; loop++) {
      printf("%c", message[loop]);
   }
   printf("\n");
 
   return 0;
}

Code:
yourname = input("What is your name? [ Type in & press ENTER KEY ]\n")
if yourname and len(yourname) > 0:
    print("Hello " + yourname)
else:
    print("Hey you!")
 

Johna

HTML, CSS and JS Coder
Staff Team
Guardian
Just trying to clear it of my account progress list : )

HTML:
<html>
    
    <head>
        <title>Hello Omnomc</title>
    </head>
    
    <style>
        #hello {
            font-family: bold;
            color: blue;
        }
    </style>
    
    <body>
        <p id="hello">Hello Omnomc</p>
    </body>
</html>
 

didlly

Legendary Coder
Staff Team
Guardian
JavaScript:
console.log("Hello Code Forum:)");
Python:
from sys import stdout
from time import sleep

# Function to animate the printing of text.
def printf(text, pause=0.05):
  for character in text:
    stdout.write(character)
    stdout.flush()
    sleep(pause)
    
printf("Hello, Apollyon.")
 

simong1993

King Coder
Staff Team
Guardian
Python:
import json
import urllib.request
import time
import requests
from bs4 import BeautifulSoup
from geopy.geocoders import Nominatim
import datetime
import timezonefinder, pytz
from datetime import datetime

def CodeForumName():
    #Get the name of the person Above me on CodeForums
    response = requests.get("https://codeforum.org/threads/say-hello-in-a-coding-language.915/page-6")
    if response.status_code in [200, 404]:
        soup = BeautifulSoup(response.text, 'lxml')
        Name = soup.find(id='js-post-13593')['data-author']
        return Name

def GetCrew():
    #Get who is currently on the ISS
    url = "http://api.open-notify.org/astros.json"
    response = urllib.request.urlopen(url)
    result = json.loads(response.read())

    AmountOfAstronauts = result["number"]
    people = result["people"]

    return AmountOfAstronauts,people

def GetISSLocation():
    while True:
        try:
            # initialize Nominatim API
            geolocator = Nominatim(user_agent="geoapiExercises")
            # load the current status of the ISS in real-time
            url = "http://api.open-notify.org/iss-now.json"
            response = urllib.request.urlopen(url)
            result = json.loads(response.read())

            # Extract the ISS location
            location = result["iss_position"]
            Latitude = location['latitude']
            Longitude = location['longitude']

            location = geolocator.reverse(Latitude + "," + Longitude)
            if location is not None:
                print("Latitude is -",Latitude,"Longitude is -",Longitude,"That puts it just above",location)
                return Latitude,Longitude
            else:
                print("Latitude is -",Latitude,"Longitude is -",Longitude,"Not above anywhere yet, lets keep looping untill we are" )

        except:
            continue

def GetTimeAndDate(Cords):
    tf = timezonefinder.TimezoneFinder()
    # From the lat/long, get the tz-database-style time zone name (e.g. 'America/Vancouver') or None
    timezone_str = tf.certain_timezone_at(lat=float(Cords[0]), lng=float(Cords[1]))

    if timezone_str is None:
        print("Could not determine the time zone")
    else:
        # Display the current time in that time zone
        timezone = pytz.timezone(timezone_str)
        dt = datetime.utcnow()
        print("The time in %s is %s" % (timezone_str, dt + timezone.utcoffset(dt)))

Crew = GetCrew()
print("Hey There" , CodeForumName(),". So i was trying to think of a way to beat my joke hello. "
                                    "\nI think i have done it :D How about if we see who is currently on the ISS, its Cords and we see that time it is. "
                                    "\nSit back and enjoy the ride :D"
                                    "\nAt the moment there is ",Crew[0],"On board and they are :-\n")
for p in Crew[1]:
    print(p['name'])

print("\nNot quite done yet :D Lets see where the ISS currently is, shall we :)")

Location = GetISSLocation()
GetTimeAndDate(Location)

print("I think this beats my joke hello from before :D, Dont you agree")

Hey There didlly . So i was trying to think of a way to beat my joke hello.
I think i have done it :D How about if we see who is currently on the ISS, its Cords and we see that time it is.
Sit back and enjoy the ride :D
At the moment there is 10 On board and they are :-

Mark Vande Hei
Pyotr Dubrov
Anton Shkaplerov
Zhai Zhigang
Wang Yaping
Ye Guangfu
Raja Chari
Tom Marshburn
Kayla Barron
Matthias Maurer

Not quite done yet :D Lets see where the ISS currently is, shall we :)
Latitude is - -24.7295 Longitude is - -68.1833 That puts it just above Municipio de Tolar Grande, Los Andes, Salta, Argentina
The time in America/Argentina/Salta is 2022-01-01 22:37:16.066112
I think this beats my joke hello from before :D, Dont you agree
 

didlly

Legendary Coder
Staff Team
Guardian
Python:
import json
import urllib.request
import time
import requests
from bs4 import BeautifulSoup
from geopy.geocoders import Nominatim
import datetime
import timezonefinder, pytz
from datetime import datetime

def CodeForumName():
    #Get the name of the person Above me on CodeForums
    response = requests.get("https://codeforum.org/threads/say-hello-in-a-coding-language.915/page-6")
    if response.status_code in [200, 404]:
        soup = BeautifulSoup(response.text, 'lxml')
        Name = soup.find(id='js-post-13593')['data-author']
        return Name

def GetCrew():
    #Get who is currently on the ISS
    url = "http://api.open-notify.org/astros.json"
    response = urllib.request.urlopen(url)
    result = json.loads(response.read())

    AmountOfAstronauts = result["number"]
    people = result["people"]

    return AmountOfAstronauts,people

def GetISSLocation():
    while True:
        try:
            # initialize Nominatim API
            geolocator = Nominatim(user_agent="geoapiExercises")
            # load the current status of the ISS in real-time
            url = "http://api.open-notify.org/iss-now.json"
            response = urllib.request.urlopen(url)
            result = json.loads(response.read())

            # Extract the ISS location
            location = result["iss_position"]
            Latitude = location['latitude']
            Longitude = location['longitude']

            location = geolocator.reverse(Latitude + "," + Longitude)
            if location is not None:
                print("Latitude is -",Latitude,"Longitude is -",Longitude,"That puts it just above",location)
                return Latitude,Longitude
            else:
                print("Latitude is -",Latitude,"Longitude is -",Longitude,"Not above anywhere yet, lets keep looping untill we are" )

        except:
            continue

def GetTimeAndDate(Cords):
    tf = timezonefinder.TimezoneFinder()
    # From the lat/long, get the tz-database-style time zone name (e.g. 'America/Vancouver') or None
    timezone_str = tf.certain_timezone_at(lat=float(Cords[0]), lng=float(Cords[1]))

    if timezone_str is None:
        print("Could not determine the time zone")
    else:
        # Display the current time in that time zone
        timezone = pytz.timezone(timezone_str)
        dt = datetime.utcnow()
        print("The time in %s is %s" % (timezone_str, dt + timezone.utcoffset(dt)))

Crew = GetCrew()
print("Hey There" , CodeForumName(),". So i was trying to think of a way to beat my joke hello. "
                                    "\nI think i have done it :D How about if we see who is currently on the ISS, its Cords and we see that time it is. "
                                    "\nSit back and enjoy the ride :D"
                                    "\nAt the moment there is ",Crew[0],"On board and they are :-\n")
for p in Crew[1]:
    print(p['name'])

print("\nNot quite done yet :D Lets see where the ISS currently is, shall we :)")

Location = GetISSLocation()
GetTimeAndDate(Location)

print("I think this beats my joke hello from before :D, Dont you agree")

Hey There didlly . So i was trying to think of a way to beat my joke hello.
I think i have done it :D How about if we see who is currently on the ISS, its Cords and we see that time it is.
Sit back and enjoy the ride :D
At the moment there is 10 On board and they are :-

Mark Vande Hei
Pyotr Dubrov
Anton Shkaplerov
Zhai Zhigang
Wang Yaping
Ye Guangfu
Raja Chari
Tom Marshburn
Kayla Barron
Matthias Maurer

Not quite done yet :D Lets see where the ISS currently is, shall we :)
Latitude is - -24.7295 Longitude is - -68.1833 That puts it just above Municipio de Tolar Grande, Los Andes, Salta, Argentina
The time in America/Argentina/Salta is 2022-01-01 22:37:16.066112
I think this beats my joke hello from before :D, Dont you agree
Nice code. I've made my own piece of code that'll automatically get the username of the last person to comment, and print it out with an animation.

Python:
from sys import stdout
from time import sleep
from bs4 import BeautifulSoup
from requests import get

def printf(text: str, pause=0.05):
  for character in text:
    stdout.write(character)
    stdout.flush()
    sleep(pause)
  
def latest_user():
    # The page number is 10000 since CodeForum automatically redirects back to the last page. This means the HTML received will always be the HTML from the latest page.
    soup = BeautifulSoup(get("https://codeforum.org/threads/say-hello-in-a-coding-language.915/page-10000").text, "html.parser")
  
    # Get the username of the last user to reply.
    return [i.attrs["href"] for i in soup.find_all("a", class_="avatar avatar--m")][-1].replace("/members/", "").replace("/", "").split(".")[0]
 
# '\033[3m' is the ANSI Escape Sequence for underlined, and '\u001b[0m' is the ANSI Escape Sequence for reset all formatting.
printf(f"Hello, \033[3m{latest_user()}.\u001b[0m")
 

⠀gb⠀

New Coder
Code:
++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>++++++++++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>.<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<>>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<<>>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<<>>>>>>>>>>>>>>-.+<<<<<<<<<<<<<<>>>>>>----.++++<<<<<<>>>>.<<<<>>>>>>>>>>---.+++<<<<<<<<<<>>>>>>>>>>>>+.-<<<<<<<<<<<<>>>>>>>>>>>>>>+++.---<<<<<<<<<<<<<<>>>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<>>>>>>>>>>>>>>++.--<<<<<<<<<<<<<<>>>>.<<<<>>>>>>>>>>>+.-<<<<<<<<<<<>>>>>>>>>>>>>>-.+<<<<<<<<<<<<<<>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<>>>>>>>>>>>>+.-<<<<<<<<<<<<>>>>+.-<<<<.
 

cbreemer

King Coder
It just occurred to me I had not completed this task yet 😄
Code:
HAI 1.2
CAN HAS STDIO?
I HAS A GREETING ITZ "HAI, FOREM MEMBERZ !"
VISIBLE GREETING
KTHXBYE
 

EkBass

Well-Known Coder
Code:
-[------->+<]>-.-[->+++++<]>++.+++++++..+++.[--->+<]>-----.[->+++<]>+.+++++++++++..[-->+<]>--------.++[--->++<]>.++++[->++<]>+.[----->+<]>-.-.+[---->+<]>+++.++[->+++<]>.-[--->+<]>--.-------.-[->+++++<]>-.---[->++++<]>.-----.[--->+<]>-----.[->+++<]>++.+++.--[--->+<]>-.-[--->++<]>--.---.+++++++++++++.-------------.[->+++<]>-.++[--->++<]>.>-[--->+<]>-.+++++++++++++.++++++++++.------.--[--->+<]>-.+[->+++<]>.--.--[--->+<]>---.-------------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.[->+++<]>+.+++++++++++..[-->+<]>--------.
 

Johna

HTML, CSS and JS Coder
Staff Team
Guardian
Code:
-[------->+<]>-.-[->+++++<]>++.+++++++..+++.[--->+<]>-----.[->+++<]>+.+++++++++++..[-->+<]>--------.++[--->++<]>.++++[->++<]>+.[----->+<]>-.-.+[---->+<]>+++.++[->+++<]>.-[--->+<]>--.-------.-[->+++++<]>-.---[->++++<]>.-----.[--->+<]>-----.[->+++<]>++.+++.--[--->+<]>-.-[--->++<]>--.---.+++++++++++++.-------------.[->+++<]>-.++[--->++<]>.>-[--->+<]>-.+++++++++++++.++++++++++.------.--[--->+<]>-.+[->+++<]>.--.--[--->+<]>---.-------------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.[->+++<]>+.+++++++++++..[-->+<]>--------.
Is this a coding language???
 
Top