๐Ÿ”€

Language comparison

The same algorithm, written three ways. The purpose isnโ€™t to learn every language at once โ€” itโ€™s to see that logic is language-independent.

๐Ÿงฉ Count from 1 to 10

1FOR I = 1 TO 102    DISPLAY I3END FOR

โœจ The logic didnโ€™t change. Only the syntax changed.

๐Ÿงฉ Even or odd

1TAKE N2IF N MOD 2 = 0 THEN3    DISPLAY "Even"4ELSE5    DISPLAY "Odd"6END IF

โœจ The logic didnโ€™t change. Only the syntax changed.

๐Ÿงฉ Find the largest in a list

1SET NUMS = [4, 17, 9, 23, 8]2SET BIGGEST = NUMS[0]3FOR EACH N IN NUMS4    IF N > BIGGEST THEN5        SET BIGGEST = N6    END IF7END FOR8DISPLAY BIGGEST

โœจ The logic didnโ€™t change. Only the syntax changed.

๐Ÿงฉ Factorial with a function

1FUNCTION FACT(N)2    SET RESULT = 13    FOR I = 1 TO N4        SET RESULT = RESULT * I5    END FOR6    RETURN RESULT7END FUNCTION8DISPLAY FACT(5)

โœจ The logic didnโ€™t change. Only the syntax changed.