# Code to display a string without calling any methods or functions [closed]

Write a code to display "I Love You". Without using any built-in tools or functions like echo, System.out.println, printf, ...

You are not allowed to directly call any function throughout the program execution, but the system environment or the compiler-generated code might do. This way, you can put your code in a main function or method that is called by the running environment, but your program should not further call any functions.

By the way, a function is not an instruction, nor a command nor an operator. So calling sum(a, b) is not valid, but making a = b + c is, even if the compiler reduces this to internal function calls.

This is a , so the valid answer with the most upvotes wins.

## closed as unclear what you're asking by cat, FryAmTheEggman, NoOneIsHere, Blue, Alex A.Jun 23 '16 at 18:48

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• So you are excluding c and many other languages. – Mhmd Feb 22 '14 at 14:32
• People here tend not to accept answers so early, since usually accepting an answer means that the contest is over. – ace_HongKongIndependence Feb 22 '14 at 14:44
• What is so bad about this challenge? Most languages won't be able to compete, but some are free to do so. For example, GolfScript works fine. PHP also works fine (paste text into blank text file). There are many other languages that can do this challenge, so why are there so many downvotes and close votes? – Justin Feb 22 '14 at 22:48
• @Quincunx This got 2 close votes as "too broad" and 2 as "primary opinion based". I do not think that this is particularly a great challenge (it is boring for me, but I really liked the brainfuck answer). However, I do not think that it should be closed (and I will vote for a reopen if it get closed). Being not much interesting and/or boring is not a close reason, and frankly, I am seeing people closing questions just for the sake of being closed using some lame excuse just because they find them boring or impossible to do in their favorite language. – Victor Stafusa Feb 23 '14 at 2:19
• @tohecz, it is not me who are asking this. But anyway, if people think that the question has problems and should be closed, normally it is adequate to drop a comment explaining why (like you and Cruncher, but none of the closers, did). Otherwise, there would be no real point in closing the question as no one would be saying to the OP what should be improved to make the question be reopened. Further, if the question has a minor problem or unclear point, people should ask or inform the OP first. In most questions, the OP fixes or clarifies the minor point quickly and no close-voting is needed. – Victor Stafusa Feb 24 '14 at 18:57

## Html-asp- xhtml-tex-php.....

I didn't use any functions

I Love You

• That is a polyglot. It's valid in php, html, xhtml, asp ... – Ismael Miguel Feb 22 '14 at 20:24
• valid in plain TeX as well, btw. And certainly doesn't use any functions, since there're no functions in the language at all. – yo' Feb 24 '14 at 12:15
• @IsmaelMiguel I agree but I'm not the one you should say that to. You should tell the OP. – Mhmd Feb 25 '14 at 5:22
• @IsmaelMiguel There! I fixed it. – Justin Mar 1 '14 at 4:43

## Brainfuck

    ++++     ++++
++[>+++   ++++>++
+>+++++++ ++++<<<-]
>+++.>++.<+++.>>+.+++
++++.--------------
---.<.<++++++++
+++++.>>+++
+++++++.+
+++++
.


The heart looks horribly thin here, but it is a lot better on a text editor / terminal

Here's a nicely indented version:

+++++ +++++ [
> +++++ ++
> +++
> +++++ +++++ +
<<< -
]
> +++ .
> ++ .
< +++ .
>> + .
+++++ ++ .
----- ----- ----- -- .
< .
< +++++ +++++ +++ .
>> +++++ +++++ .
+++++ + .

• There's a much shorter one – mniip Feb 22 '14 at 14:30
• @mniip Length is not a concern in this question since it is not code golf. So I'd go for a slightly longer one, which makes it easier to make it look like a heart. – ace_HongKongIndependence Feb 22 '14 at 14:37
• nicely indented version:) LOL – V-X Feb 23 '14 at 11:38
• aren't "." equivalent to putchar, which is in terms of brainfuck like echo? – V-X Feb 24 '14 at 10:34
• @V-X the OP said "no functions", and I'm quite certain there aren't any functions in brainfuck – ace_HongKongIndependence Feb 24 '14 at 11:14

# Javascript:

var l='I love you.';
if(window)window.status=l;
throw new l;


The part where it says 'function' is as ASSIGNMENT!

There is nothing in the question saying I can't assign functions and trigger events.

And the 'throw new l;' will say "I love you" in the error message.

This will show 'I love you' in the console, document, title and in the status bar.

# C

void main( )
{
char *string="I Love You";
volatile char *video = (volatile char*)0xB8000;
while( *string != 0 )
{
*video++ = *string++;
*video++;
}
}

• you are using the main function. – Mhmd Feb 22 '14 at 14:34
• We are not allowed to call any function, Without main() how will you write a pgm ? – Venkatesh K Feb 22 '14 at 14:34
• I don't know you wrote the question not me. – Mhmd Feb 22 '14 at 14:36
• Nope, Read the question once again.. In this code no function call has been made. That's it.. – Venkatesh K Feb 22 '14 at 19:34
• @vengets int main(){ printf("I love you"); } I don't do any function call, that's the processor who does. (Almost like: "It's not my fault, it's the knive who killed that guy!") – yo' Feb 24 '14 at 19:50

# Mathematica, GolfScript, Python Interpreter, bc

This outputs the sentence:

"I love you"

• Polyglot; works in GolfScript and Python Interpreter too. Works in PHP but outputs with the quotes. – Justin Feb 23 '14 at 0:16
• Also works in bc. – manatwork Feb 24 '14 at 9:04
• @Quincunx, manatwork, I included the languages you mentioned in the title. – DavidC Feb 24 '14 at 10:01

# PHP

Quite rule bending maybe...

<? ?>I Love You


# HTA - HyperText Application

I Love You


Microsoft says any plain text is valid HTA. They even mention in their official documentation that their "Hello, World." can be as simple as:

Hello, World.


Although most examples that you see on the web go the "official" route.

## Shell Script

mkdir "I Love You"
cd I\ Love\ You/
pwd | grep -o '/I Love You' | cut -c2-


# Smalltalk

as there is a read-eval-print-loop, and strings are self evaluating, this is trivial. From the command line, type this:

stx -P "'I love you'

A workspace, which is a basically a graphical wrapper for the eval, type in a string and select the "printIt" menu function.

# DOS Command Prompt

C:> prompt I Love You
I Love You

• I am wondering why my bold text is not as big and bold as others'. – microbian Feb 24 '14 at 20:26
• Because they are not using a bold text,they are using headers. Try adding a # before the title. (remove the *) – Mhmd Feb 25 '14 at 12:57
• Or put ======== under the title. Only one is enough, but I usually put the same number of = as the length of the title – Ismael Miguel Feb 26 '14 at 9:44
• is prompt not an external function? – Braden Best Feb 28 '14 at 20:09
• Prompt is a command, but it's purpose is NOT to print strings. – microbian Feb 28 '14 at 20:30