Michael Buen
Michael Buen

Reputation: 39393

On your very first program, which construct hooked you on programming?

To me it was the If statement, I'm psyched up, since then I believed that computers are very intelligent, or I can at least make it appear intelligent because of it.

Upvotes: 5

Views: 1192

Answers (30)

Dead account
Dead account

Reputation: 19960

Lambda expressions

Been programming my nearly my whole life, but even now find excitement in new things like Lamdba expressions.

 MyList.Any(p => p.IsCurrent)

Hmm.. love it.

Upvotes: 3

Kristopher Johnson
Kristopher Johnson

Reputation: 82535

For many of us who were introduced to computers in the late 70's or early 80's, the first program we saw looked like this:

10 PRINT "Commodore sucks!  "
20 GOTO 10

("Commodore" could be replaced with "Apple", "Atari" or "TRS-80").

GOTO is awesome.

Upvotes: 18

Michael Stum
Michael Stum

Reputation: 180944

POKE 53280,5

Changes the screen border on the C-64 to purple. Put that in a for-loop to loop the color from 0 to 15 and you will get kids excited about programming. Well, at least in the late 80's/early 90's, that is.

Upvotes: 0

hashwarp
hashwarp

Reputation: 3933

I think my first program (aside from noob PHP) was something building towards an RPG for Nintendo GBA. I loved how you could manipulate the bits and bytes into an awesome game. I lost interest when Nintendo DS was released, not only because it hadn't been reverse engineered for homebrew compiling, but also development requirements substantially increased.

It didn't "hook" me, but cout << "Hello World!" << endl; was pretty awesome. I never understood how anyone could use a console though, so I went straight to win32 UI, lol. Lost interest very quickly until adulthood. Good times.

Upvotes: 0

Stefano Borini
Stefano Borini

Reputation: 143795

I started with basic, but what really blew me off was LOGO, a language that allowed you to program a "virtual pen" (called turtle) to draw stuff on the screen. I started drawing very complex shapes, and considering my young age, I was totally involved.

Upvotes: 0

Peter Perh&#225;č
Peter Perh&#225;č

Reputation: 20782

In QBASIC there was the command PLOT, and when I first wrote a program that would draw a spiral on screen, there came the feeling of accomplishment. And I guess that was when I understood computers can do awesome things, and I stuck with them for the next couple of decades.

(Nostalgia. I can still remember the lime-green spiral on the black screen...)

Upvotes: 0

Adrian Panasiuk
Adrian Panasiuk

Reputation: 7343

This is not a language construct, but I was enchanted when I discovered that the effect of changing TextAttr (text color, Pascal) would remain even after returning from my program to DOS.

Upvotes: 0

Laserallan
Laserallan

Reputation: 11312

What really made me hooked on programming was the following lines of x86 assembler:

mov ax, 13h
int 10h
mov ax, 0a000h
mov es, ax

When I got how easy it was to draw things by messing with the video memory, all the other stuff I've learned was suddenly useful for something.

Upvotes: 1

Nope
Nope

Reputation: 36000

for or while loop since I could use it in molecular dynamics simulations and I wouldn't have to do the computations one at a time by hand

Upvotes: 2

mndoci
mndoci

Reputation: 1

The first Fortran code I wrote had an if statement in it, and was one of the most fascinating things I had seen at the time. Something like this one

     integer n

     n = 1
  20 if (n .le. 100) then
        n = 2*n
        write (*,*) n
        goto 20
     endif

Upvotes: 4

Markus Jarderot
Markus Jarderot

Reputation: 89171

I started at around 7-8 years of age (1992-93) in QBasic. A friend (same age) showed me the amazing graphical programs he could do. I often asked something like "Could you make the ... do ... instead?", and he could!

One program I still remember was something resembling fluid filling up the screen, intially containing a few big and thick circles. Scanning left to right and back again, bumping into walls, and exploding (!) if it gets stuck somewhere.

Upvotes: 0

Mark Brittingham
Mark Brittingham

Reputation: 28865

Functions as a programming construct. No matter how big the problem, I could break it down into sensible calls to a set of functions. If the problem to be solved by any one function was too big, I could break it down as well (we didn't call it refactoring then). Sooner or later, I thought, I could solve anything by just finishing the functions.

More generally, I was hooked on development when I realized that I could create processes that determined how a team, a department, a business, or even an entire industry would work. And that I could help them work better and faster.

Upvotes: 0

pi.
pi.

Reputation: 21532

Clear case, the loop. Specifically looping in Gwbasic. Just for fun I wanted to print all the numbers from 0 to 100 on the screen. So I started:

10 print 1
20 print 2
30 print 3
40 print 4

At some point I thought WTF or something similar. There must be a better way. So I asked someone (perhaps a teacher or some fellow pupil) who then introduced me to the magics of variables and the loop. That must have been the moment I got hooked.

10 SET i = 0
20 IF i > 100 THEN GOTO 60
30 PRINT i
40 SET I = I + 1
50 GOTO 20
60 REM END LOOP

Thats 6 lines instead of 100!!! That was just so much better. Sorry if I got the syntax not exactly right. :-) I am really fond of that moment.

Upvotes: 3

tunnuz
tunnuz

Reputation: 23978

Absolutely while! But my programming experience is pretty recent.

Upvotes: 0

Greg Hurlman
Greg Hurlman

Reputation: 17804

Most definitely the FOR loop - at 6 years old, having that lil' LOGO Turtle go from drawing a line to drawing a square to drawing a circle was all it took to turn me from a user into a programmer.

Upvotes: 3

Jared
Jared

Reputation: 39887

Mine was goto in basic. I thought it was incredible you could make the program jump where ever you wanted it to. Only later did I realize with great power comes great responsibility.

Upvotes: 1

John Turnbull
John Turnbull

Reputation: 3

When DBase II allowed me to print records to a text file AND stick exactly the right typesetting codes pretty much where I wanted -- before them, inside them, behind them, around them. I can still feel the chill on the back of my neck. WOW a whole whole typesetting system right here in my tiny computer! Warm up the 300 baud modem and send this file straight to an 8-inch disk and run it through a Compugraphic. Yards of beautifully shiny photo-type paper with all the letters in the right place. I do not deserve this happiness ...

Upvotes: 1

Michael Buen
Michael Buen

Reputation: 39393

Aside from if statement(which I learned first from Pascal[first language learned]). The one-to-one correspondence between pointers and arrays in C was what truly hooked me to programming. It brings my understanding of computer's ability to great heights, including but not limited to, efficient memory traversal, stacks, passing a specific portion(slicing) of an array to a function, treat the pointer to memory-mapped IO(e.g. VGA address) as an array. In Pascal, the pointer is so opaque that the programmer's understanding of computer memory and its ability is severely hampered.

Upvotes: 0

BBetances
BBetances

Reputation: 925

I've only been programming for about a year, so for me, it was LINQ. I looked at codes in books that exposed the query string to the DB, and thought "wow, that's kind of lame.". The I met LINQ and we have been happily married ever since.

Upvotes: 1

Ed Guiness
Ed Guiness

Reputation: 35267

The beginnings of structured programming in BASIC with...

GOSUB 1000

Upvotes: 0

Ed Guiness
Ed Guiness

Reputation: 35267

The DOS interrupt

INT 21h

Upvotes: 0

Ed Guiness
Ed Guiness

Reputation: 35267

TRS-80 graphics

POKE 15360, 191

Upvotes: 0

abelenky
abelenky

Reputation: 64682

I found ++ to be fascinating in high school.

Everyone else knew Basic, Pascal, etc. But i++ was code! And code that only I knew!

And such tiny changes could have very important effects: ++i is different in many important ways from i++. And ++ translates so directly all the way down to machine code. So by learning this, I had direct access to the CORE of the MACHINE. Imagine the power!

Learning about this made me want to learn all the other strange operations and corners of the C language.

Upvotes: 0

Filip Ekberg
Filip Ekberg

Reputation: 36287

qBasic, when I was around 10 - 12 i started making a copy of that "The doctor asks you weird questions"-game. Which ended up as a lot of nasty questions. That's when i knew I wanted to work with computers.

A couple of years later i started playing with HTML and PHP, giving me a couple of customers and i started a company, that's when i knew i could get bloody rich on this :)

Upvotes: 1

EricSchaefer
EricSchaefer

Reputation: 26340

PRINT 3 + 4
The Computer said 7. And all this was visible on my parents TV. ON A TV!!! Can you imagine that? I was imediately hooked. You could tell a machine what to do and you could see on a TV. Wow.

Backgound: My dads employer bought a small computer (Robotron KC 85/1) for the engineers to get in touch with this technology. They could take it home to play with it at the weekend. So my dad brought it home and all he new about it was how to connect it and how to turn it on. One of his collegues told him the trick with the "PRINT" command and the addition of numbers. He showed me and I was hooked. This was about 1986 when I was 12. I am still hooked for basicly the same reason (telling a machine what to do).

Upvotes: 1

Prakash Mani
Prakash Mani

Reputation: 115

Inspired the word

BASIC Beginners All Purpose Symbolic Instruction Code

Upvotes: 0

EndangeredMassa
EndangeredMassa

Reputation: 17528

For Loops + Arrays did it for me. Once I realized that I could loop through an arbitrarily large set of things and do something to each of them, it all started to come together.

Upvotes: 3

Roman Pl&#225;šil
Roman Pl&#225;šil

Reputation: 1970

I really fell in love with programming languages once I discovered comments. You can do all kind of stuff with it, like

// a commment!
int /* whoa, an inline comment! */ a;

;)

Upvotes: 3

alcortes
alcortes

Reputation:

Function pointers in C.

First I learned C, but not function pointers.

Then I began programming in assembler for about a semester in the university. I used function pointers then without even knowing about them. Somehow they seem like a natural thing in assembler for me. I had to explain them to my teachers a few times, because they didn't understand them :).

Then, I came back to C, and revelation hit me.

Now I laught at Java methods, generics, late polymorphism and such said "magic" things.

Upvotes: 1

Ivan
Ivan

Reputation: 103879

From my first BASIC book (BASIC for kids I believe):

10 INPUT A
20 INPUT B
30 LET C = A + B
40 PRINT C

That was on the cover of the book, and I was thrilled with the possibilities (it could do my homework!)... It took me like a couple of weeks to grasp that simple concept, but once I got it, the world of programming opened up for me.

Upvotes: 3

Related Questions