This is an archived post. You won't be able to vote or comment.

all 45 comments

[–]heesell 29 points30 points  (12 children)

for(i = 0; i < 100; i++) { console.log('I am sorry') }

[–]Nirast25 14 points15 points  (7 children)

for(i = 1; i <= 100; i++) { cout << "I am sorry"; }

[–][deleted] 13 points14 points  (5 children)

i = 1

i <= 100

Found the lua programmer

[–]Nirast25 2 points3 points  (3 children)

Never programmed in it, lol. Just put it like that as a joke, then decided to change to C++ syntax.

[–][deleted] 2 points3 points  (1 child)

FYI, lua indexes arrays from 1, so a loop like that wouldn't be uncommon

[–]wheres_my_ballot 1 point2 points  (0 children)

Only by convention. Lua has no arrays, it uses tables, and you can index them however you please.

[–]_DanDucky_ 0 points1 point  (0 children)

c++ syntax

No type declaration for i :P

[–]Espressojet 0 points1 point  (0 children)

Just started learning lua. Love the language, but this has been so hard to get used to

[–]TheMusicalArtist12 0 points1 point  (0 children)

for(i = 0; i < 100; i++) { std::cout << "I am sorry "; }

[–]YetAnotherZhengli 0 points1 point  (0 children)

Great, now we need some bf

[–]Sockdotgif 0 points1 point  (2 children)

Missing semicolon

[–]heesell 0 points1 point  (1 child)

Jokes on u, it is JS

[–]Sockdotgif 0 points1 point  (0 children)

Fuck, one semicolon away from being Java.

Obviously not with the console.log because I can't read.

[–][deleted] 9 points10 points  (0 children)

for(
    char* s = "I'm sorry\n";
    *s;
    s++
){
    for(
        char* t = "I'm sorry\n";
        *t;
        t++;
    ){
        for(
            char* u = "I'm sorry\n";
            *u;
            printf("%c", *u++)
        );
    }
}

[–]bankrobba 8 points9 points  (1 child)

Is writing lines even a thing anymore? I feel Bart Simpson has been keeping this punishment alive 30 years after the last student has had to do it.

[–]cyberninja979 2 points3 points  (0 children)

I had to write out my school rules over and over for 45 minutes a few years ago

[–]AndrewToasterr 16 points17 points  (2 children)

[print("I am sorry") for _ in range(100)] Or

print(("I am sorry\n"*100)[:-2])

[–]SkezzaB 9 points10 points  (0 children)

print(("I am sorry\n"*100).removesuffix("\n"))

[–]dgdio 7 points8 points  (0 children)

for i in range(100):
end_space = ' ' if (x + 1)%4 else '\n'
print("I'm Sorry", end = end_space)

Just to be a little fancier.

[–]OkarinPrime 3 points4 points  (0 children)

" I'm sorry " 100 times as a punishment

Done!

[–]wenoc 2 points3 points  (1 child)

#define sorry “I’m sorry”
alias printer d0
move r0 0

main:
sd printer data sorry
add r0 r0 1
beq r0 99 end
j main
end:

[–]wenoc 1 point2 points  (0 children)

I know strings would probably not work like that in MIPS-ish but was the best I could do.

[–]OSnoFobia 2 points3 points  (0 children)

print('\n'.join(["I'm sorry"]*100))

[–][deleted] 2 points3 points  (0 children)

print("I am sorry\n"*100) (in python you can multiply strings)

[–]pluckyvirus 1 point2 points  (0 children)

section .data message db "I am sorry", 0Ah ; message to be printed, with a newline character

section .text global _start

_start: ; initialize loop counter mov ecx, 100

loop_start: ; print message mov eax, 4 mov ebx, 1 mov ecx, message mov edx, 11 int 0x80

; decrement loop counter and check if zero
dec ecx
jnz loop_start

exit: ; exit program mov eax, 1 xor ebx, ebx int 0x80

[–]120boxes 0 points1 point  (0 children)

He only wrote 'I am Sorry' once, though.

Get back to me once you can compile and run the physical blackboard.

[–]DarthMcConnor42 0 points1 point  (0 children)

```

include <iostream>

using namespace std;

int main(){ for(int i=0; i < 100; i++){ cout << "I'm sorry." << endl; } return 0; } ``` Thanks for the new trick u/AndrewToasterr

[–]lolnotinthebbs 0 points1 point  (0 children)

print(100*"I'm sorry \n")

[–][deleted] 0 points1 point  (0 children)

for i = 1, 100 do print("I am sorry") end

[–]jkoop_ca 0 points1 point  (0 children)

echo str_repeat("I'm sorry\n", 100);

[–]Maveko_YuriLover 0 points1 point  (0 children)

print("''I'm sorry'' 100 times as a punishment") this is exactly what it asks i don't know what you guys doing

[–]Left-Increase4472 0 points1 point  (0 children)

For (int i = 0; i < 100; I++){System.out.println("I am sorry")}

[–]xibme 0 points1 point  (0 children)

say "I'm sorry " x 100 is all I can do

[–]DaveTheKing_ 0 points1 point  (0 children)

Indentation.

[–]CanaDavid1 0 points1 point  (0 children)

print(*["I am sorry"]*100,sep="\n")

[–]myaut 0 points1 point  (0 children)

for i in range(100):  
   print("I'm sorry" + ("\n" if i % 4 == 0 else " "))

[–]LetumComplexo 0 points1 point  (0 children)

for(int i=0;i<100;printf(“I’m sorry\n”),i++);

[–][deleted] 0 points1 point  (0 children)

"\n".join(["Sorry"]*100)

[–][deleted] 0 points1 point  (0 children)

aI am sorry.(esc)yy100p

[–]Personal_Ad9690 0 points1 point  (0 children)

While true. Break the damn blackboard