The Challenge
Write a program that outputs Hello World, from line X!
, where X
is the line number, in the source code, of the actual print statement itself.
The Rules
- In this context, we want the first line number of the statement which outputs the string to be displayed to
stdout
- You should avoid simply searching through your source code as a string (either file or quine) to find the line number
- If any additional whitespace or statements (which do not interrupt the flow of the code) is added to the source code, it should be reflected at run-time (after compiling if applicable)
Recommendations
If provided by the language, you may use exceptions/stack traces to accomplish this goal. Try your best to use code that is portable across different systems/implementations, but note that this is not a requirement. Using defined variables like __LINE__
, although allowed by the rules, are discouraged.
The Winner
This is a popularity contest (ended on June 10, 2014), where the answer voted highest by the community will be declared the winner based on the current votes at the time
When voting, please consider the creativity of someone's answer, how elaborate or interesting it is. and the difficulties/constraints of the programming language being used