I am such a great programmer

I wrote a function to get the length of pretty much anything in both Python and JavaScript. It is really great, some of my best work ever. It does it all in a mere four lines. I will be updating my active projects to use this fantastic work. Since it is so great and everyone should be able to use it, I have posted the code for both languages below. Who knows, perhaps programming languages will take this code and implement it into the core language, then we would not have to rely on us remembering the requirement of putting in any of our projects that need such an ability! 😀

Python

def len(item):
    i = 0
    for char in item:
        i += 1
    return i

JavaScript

function len(item) {
    i = 0;
    (for char in item) {
        i += 1;
    }
    return i;
};

I told you, I am such a great programmer. 😀

Advertisements

6 thoughts on “I am such a great programmer

Triangular Reactions

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s