News for hackers. Stuff that matters.

Ask HN: Beyond Hello World in multiple languages?

I work in a lot of different languages on a regular basis, and it can be hard to keep track of some of the syntax between Python, MATLAB, Swift, JS, R, C++, ...

Does anyone have a good resource for "Hello World" type examples in multiple languages that go a little beyond `print("hello world");`?

I would be happy to start with code that at least includes a function definition and a for loop, but my eventual goal would be to fill about 1 page of code in each language with the most common actions.

Does something like this exist? I don't want to recreate it if someone can point me to a good existing project.

Thanks!

( 6 comments | on HN )
Re:Ask HN: Beyond Hello World in multiple languages? by compressedgas on Wednesday April 14, 2021 @10:53AM (#26807937)
You might be interested in https://hyperpolyglot.org/
Re:Ask HN: Beyond Hello World in multiple languages? by chrisBob on Wednesday April 14, 2021 @11:17AM (#26808305)
That is interesting and certainly has all of the pieces I am looking for. This project isn't anywhere near what I want for a final result, but would make the pieces easy to find as I am putting it together.
Re:Ask HN: Beyond Hello World in multiple languages? by cratermoon on Wednesday April 14, 2021 @10:52AM (#26807909)
Re:Ask HN: Beyond Hello World in multiple languages? by chrisBob on Wednesday April 14, 2021 @11:26AM (#26808417)
This looks like the best starting point for me so far. The fact that they are real, useful programs means that I would need to cut a bunch for any of the examples I looked at so far, but I like it as a starting point.
Re:Ask HN: Beyond Hello World in multiple languages? by elyseum on Wednesday April 14, 2021 @10:58AM (#26808018)
Maybe not a starting point because it’s too advanced, but Make A Lisp has example implementations for +80 languages now: https://github.com/kanaka/mal
Re:Ask HN: Beyond Hello World in multiple languages? by chrisBob on Wednesday April 14, 2021 @11:11AM (#26808215)
That is an interesting advanced project, but it is hard to find a consistent 1-page section in all of the languages.