3
arvinds
31d

My first function which I wrote 3 years ago..
Adding two numbers in JavaScript.

add = function ( a, b ) {
Return a + b;
}

What's yours ?

Comments
  • 5
    public int GetResult()

    {

    if (i==1)

    {

    return 5*10*1;

    }

    else if(i==2)

    {

    return 5*10*2;

    }

    else if(i==3)

    {

    return 5*10*3;

    }

    else if(i==4)

    {

    return 5*10*4;

    }

    ...

    else if(i==20)

    {

    return 5*10*20;

    }

    }

    Here is my embarrassing dark past. When I started programming I don't know how to use loop correctly.
  • 0
    @mr-user it's beautiful.
  • 0
    @sweetnothings Please have mercy on my younger self.
  • 0
    @sweetnothings sorry if I disappointed you 😛
  • 1
    hmm my first function....
    i think (other than main) it was something like

    @highlight
    void Button1_Click( Object sender, EventArgs e ) {
    if (Textbox1.value == 2) Textbox2.value = "10"
    //and such for all the binary conversions from 0 to like 128 or something
    }

    it was autogenerated from the windows forms builder and i didn't know how to rename form elements back then haha
  • 0
  • 2
    @sweetnothings this reminds me Daenerys Targaryen 🔥
  • 1
    @sweetnothings dracarys...
  • 0
    Don’t remember my first function, I think it was just something I copied from internet and modified a bit. Anyway, my first finished program was a mod for a game, it contained about 5k loc, everything was in single file and had no indentation, looked pretty much like code above posted by @mr-user
  • 1
    @sweetnothings Bangalore my queen.
  • 0
    @sweetnothings life and death is not in our hands..let's leave that to god 😁
  • 1
    :1
    start cmd.exe
    goto 1
  • 0
    Breathing, probably.
  • 0
    First function ever written:

    Public void sayHello() {
    System.out.println("Hello");
    }
  • 0
    @Ranchu I couldn't understand what is it ?
  • 0
    I think mine was a python script to print hello world
  • 0
    I still have pretty much every program I've every written.

    The first programs are now on Gitlab in a "sourcecode 1992" repo as well as on my home server. They were transferred from cassette tape, to 5.25 floppy, to diskette, to hard disk, to cloud.

    First one gives infinite poop (I was a kid, what do you expect)

    10 ?"POOP"

    20 GOTO 10

    The second one came from a magazine, and prints a randomized maze.

    5 REM Random Maze

    10 ?"{CLR/HOME}"

    20 ? CHR$(205.5 + RND(1));

    30 GOTO 20
  • 0
    @bittersweet

    I am spoiled. What language it is?
  • 0
    @mr-user Commodore64 Basic.
  • 0
    // math.bat
    calc.exe
  • 1
    I didn't write a function

    I modified a entire bot in JavaScript for Discord.

    Boy that was quite a rollercoaster ride.
  • 1
    My first function ever was a bash function
Add Comment