Jump to content

Talk:"Hello, World!" program/Archive 2

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 04:04, 16 October 2022 (Archiving 2 discussion(s) from Talk:"Hello, World!" program) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 2

A Commons file used on this page or its Wikidata item has been nominated for deletion

The following Wikimedia Commons file used on this page or its Wikidata item has been nominated for deletion:

Participate in the deletion discussion at the nomination page. —Community Tech bot (talk) 05:55, 30 June 2021 (UTC)

Brian Kernighan an inventor of BCPL?

"This claim is supposedly supported by the archived notes of the inventors of BCPL, Brian Kernighan at Princeton and Martin Richards at Cambridge."

I don't think so. From what I can see Kernighan might have written the first "hello world" in BCPL, but BCPL was developed in UK before migrating to US where Kernighan came across it.

Maybe someone can produce documentary evidence, but I have not seen it in any BCPL documentation. — Preceding unsigned comment added by Ian.joyner (talkcontribs) 10:18, 10 December 2021 (UTC)

According to https://ozanerhansha.medium.com/on-the-origin-of-hello-world-61bfe98196d5
Unsure myself of whether the first documented use of “Hello, World!” was in BCPL or B, I emailed Prof. Kernighan and he confirmed it:
I have never written a line of BCPL, so I definitely never wrote a hello world example for BCPL documentation. As best I can recall, the original example was for the internal B manual that I wrote at Bell Labs…
I'll delete the Kernighan reference to BCPL. I suggest it is only reinstated if someone can provide any evidence that Kernighan had anything to do with the design of BCPL. Ian.joyner (talk) 02:40, 26 March 2022 (UTC)

JavaScript also uses document.write();

The paragraphs I wrote below have been modified after hearing arguments from both sides as of 28 April 2022

console.log(); no longer works is not the only way to output on JavaScript. To output a 'Hello, world!', A document.write(); function is needed program will also output. If you don't believe me and/or still believe console.log(); works is the only output, try it yourself on W3schools, repl.it, or any other IDE with JavaScript included. If I don't see a console.log(); used document.write(); on this page, I will add it to the page. If someone removes it, I will act quickly to revert such edits. FlyDragon792, 02:26, 02 January 15:50, 28 April 2022 (UTC)

I'm not sure what you mean by "no longer works". console.log("hello, world"); works fine in the console of all browsers which support such things. It, when embedded in an HTML page as a script, outputs to the console log just fine. It doesn't modify the DOM like document.write() does but I think using console.log is fine as both something that currently works and more common as a hello world Javascript (alert is/was also common). See [1] and [2] for a couple of examples. If we only have one JS example in this article, I'm not sure which is the best one, I'd personally lean toward console.log or alert but at the very least reverting console.log because it doesn't work isn't correct since it works as well as it ever did (quite well for its purpose). Skynxnex (talk) 17:08, 23 January 2022 (UTC)
Are you sure you are using the latest version of: JavaScript, Windows, or your browser about this? Because console.log('Hello, World!') did not work for me when testing the code in W3 3.7, JavaScript 5, Windows 10/11, or Edge 98, but document.write('Hello, World!'); does. Also, alert('Hello, World!') is not really 'printing' the string onto an IDE. FlyDragon792, 04:46, 07 February 2022 (UTC)
It works in Chrome, Firefox, Edge, and more. Where have you see any documentation that it stops working? In-browser playgrounds are not always the best. If you use it interactively in the browser's inspector it runs fine there.[3][4] If you have an HTML document that includes a script tag with console.log that will show up in that output as well. document.write will clearly make that message appear but as just a single line it also obliterates anything that was already on the page. console.log also has the advantage of working in Node.JS, while the other two options don't. And MDN has a more complex example using textContent. [5] has all three mentioned show. So they clearly all work. I think a reasonable solution is showing both console.log and document.write in some some equal fashion, but we don't really want the examples to be complex. Maybe something like:
JavaScript
Using DOM manipulation:
document.write("Hello, World!")
Using a browser's web development tools or Node.js:
console.log("Hello, World!")
As an idea. Skynxnex (talk) 20:05, 7 February 2022 (UTC)

Messages

Message: Why don't add some more "Hello, World!" examples in some programming languages such as Ada, in the "Hello, World!" program page? Please add now and quick! — Preceding unsigned comment added by Mihai000 (talkcontribs) 13:18, 12 May 2022 (UTC)