For me, it was an If statement, I am excited, since then I believed that computers are very smart, or I can at least make it understandable because of it.
When I first started learning programming with QBASIC, the whole idea of flow control using if statements and loops was great. I think it was only a few days after I found out about the if statement in which I built my first game, "Choose Your Adventure." Looking back, I know that this must have been terribly inefficient and massive in terms of lines of code, but the fact that I could fork this story using nothing but the statements were wonderful.
For many of us familiar with computers in the late 70s or early 80s, the first program we saw looked like this:
10 PRINT "Commodore sucks! " 20 GOTO 10
(Commodore can be replaced with Apple, Atari, or TRS-80.)
GOTO is amazing.
# 2:)
, , - .
SumDigits, . : SumDigits (1234) → 10
. .
string SumDigits(int value) { if ( value > 10 ) { return SumDigits(value/10) + (value%10); } return value; }
, .
, :)
( ), , .
.
, :
QBasic, , :
INPUT "What your name?", a$ PRINT "Hi, "; a$; "!"
- PRINT , . INPUT !
PRINT
INPUT
Turbo Pascal, , . , , - .
, , , , - ! - , ...:)
- , ZX Spectrum - , - , .
, , , , - , .
? "HELLO WORLD"
BASIC (BASIC , ):
10 INPUT A 20 INPUT B 30 LET C = A + B 40 PRINT C
, ( !)... , , , .
, . ,
// a commment! int /* whoa, an inline comment! */ a;
;)
Loops + Arrays . , - , .
FOR - 6 , lil 'LOGO Turtle, - , , .
, . , Gwbasic. 0 100 . , :
10 print 1 20 print 2 30 print 3 40 print 4
- , WTF - . . - (, - ), . , , .
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 100!!! . , .:-) .
Fortran, , if, , . -
integer n n = 1 20 if (n .le. 100) then n = 2*n write (*,*) n goto 20 endif
-
, , .
MyList.Any(p => p.IsCurrent)
.. .
, , . . , qbasic:).
, , . , Visual Basic 6 , C, , .
. , , , , . , "whaaa?"
, . Computing, , , .
, . , .
,
? , . , , - . "" , .
, , . .
IF-GOTO.
. , , .
C.
C, .
. , . - . , :).
Java, , "" .
PRINT 3 + 47. . !!! ? . , , . .
PRINT 3 + 4
Backgound: - (Robotron KC 85/1), . , . , , , , . "PRINT" . , . 1986 , 12 . ( , ).
qBasic, 10 - 12, , " " - . . , , .
HTML PHP, , , , , :)
, LINQ. , , ", ". LINQ, .
DBase II , - , , , . . WOW , ! 300- 8- Compugraphic. . ...
. , , , . , .
while while, ,
, x86:
mov ax, 13h int 10h mov ax, 0a000h mov es, ax
, , , , , -.
. , , . , - , , ( ). , , , .
, , , , , , . .
BASIC B eginners A ll P urpose S ymbolic I nstruction
++, .
Basic, Pascal .. ++ ! , !
And such tiny changes can have very important consequences: ++ I am different from i ++ in different ways. And ++ translates this right down to machine code. Therefore, upon learning about this, I had direct access to CORE MACHINE. Imagine the power!
Having learned about this, I wanted to know all the other strange operations and corners of the C language.