Poniżej znajdziesz przykładowy program do każdego języka dostępnego na Ideone. Kliknij klonuj aby uruchomić kod.

Ada95 (gnat 8.3) klonuj pobierz   
  1. with Ada.Text_IO; use Ada.Text_IO;
  2. with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
  3.  
  4. procedure Test is
  5. subtype Small is Integer range 0..99;
  6. Input : Small;
  7. begin
  8. loop
  9. Get(Input);
  10. if Input = 42 then
  11. exit;
  12. else
  13. Put (Input);
  14. New_Line;
  15. end if;
  16. end loop;
  17. end;
Assembler 32bit (gcc 8.3) klonuj pobierz   
  1. .data
  2. x:
  3. .long 0
  4. s:
  5. .string "%d\n\0"
  6.  
  7. .text
  8. .global main
  9. main: # int main()
  10. # {
  11. loop: # for (;;) {
  12. pushl $x # scanf("%d", &x);
  13. pushl $s
  14. call scanf
  15. addl $8, %esp
  16.  
  17. movl x, %eax # if (x == 42) break;
  18. subl $42, %eax
  19. jz break
  20.  
  21. pushl x # printf("%d\n", x);
  22. pushl $s
  23. call printf
  24. addl $8, %esp
  25.  
  26. jmp loop # }
  27. break:
  28.  
  29. xor %eax, %eax # return 0;
  30. ret
  31. # }
  32.  
Assembler 32bit (nasm 2.14) klonuj pobierz   
  1. global _start
  2.  
  3. section .data
  4. buffer dw 0h
  5.  
  6. section .text
  7.  
  8. _start:
  9. mov ecx, buffer
  10. mov edx, 02h
  11. call read
  12. mov cx, word [buffer]
  13. cmp cx, 3234h
  14. je exit
  15. cmp ch, 0ah
  16. je one_dig
  17. jmp two_dig
  18.  
  19. one_dig:
  20. mov ecx, buffer
  21. mov edx, 02h
  22. call write
  23. jmp _start
  24.  
  25. two_dig:
  26. mov ecx, buffer
  27. mov edx, 02h
  28. call write
  29. mov edx, 01h
  30. mov ecx, buffer
  31. call read ; read the 0ah
  32. mov ecx, buffer
  33. call write ; write the 0ah
  34. jmp _start
  35.  
  36. exit:
  37. mov eax, 01h ; exit()
  38. xor ebx, ebx ; errno
  39. int 80h
  40.  
  41.  
  42. read:
  43. mov eax, 03h ; read()
  44. mov ebx, 00h ; stdin
  45. int 80h
  46. ret
  47. write:
  48. mov eax, 04h ; write()
  49. mov ebx, 01h ; stdout
  50. int 80h
  51. ret
AWK (mawk 1.3.3) klonuj pobierz   
  1. BEGIN {
  2.  
  3. }
  4.  
  5. {
  6. num = $1;
  7. if(num == 42)
  8. else
  9. printf("%d\n", num);
  10. }
  11.  
  12. END {
  13.  
  14. }
AWK (gawk 4.2.1) klonuj pobierz   
  1. BEGIN {
  2.  
  3. }
  4.  
  5. {
  6. num = $1;
  7. if(num == 42)
  8. else
  9. printf("%d\n", num);
  10. }
  11.  
  12. END {
  13.  
  14. }
Bash (bash 5.0.3) klonuj pobierz   
  1. #!/bin/bash
  2. while true
  3. do
  4. read line
  5. if [ $line -eq 42 ]
  6. then
  7. exit 0
  8. fi
  9. echo $line
  10. done
BC (bc 1.07.1) klonuj pobierz   
  1. while (1 == 1) {
  2. x = read();
  3. if (x != 42) {
  4. print x, "\n";
  5. } else {
  6. break;
  7. }
  8. }
  9.  
Brainf**k (bff 1.0.6) klonuj pobierz   
  1. >+[>>,----------[>,----------]+++++[<-------->-]<[>>-<]>+[
  2. -<+++++++[<------>-]<[>>-<]>+[
  3. -<<[>>-<]>+[<<->>->]>
  4. ]<+++++++[<++++++>-]>>
  5. ]<++++++++[<+++++>-]<
  6. [<]<[>>[++++++++++.>]++++++++++.[[-]<]]<]
C (gcc 8.3) klonuj pobierz   
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x;
  5. for(; scanf("%d",&x) > 0 && x != 42; printf("%d\n", x));
  6. return 0;
  7. }
C# (gmcs 5.20.1) klonuj pobierz   
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int n;
  8. while ((n = int.Parse(Console.ReadLine()))!=42)
  9. Console.WriteLine(n);
  10. }
  11. }
C# (NET 6.0) klonuj pobierz   
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int n;
  8. while ((n = int.Parse(Console.ReadLine()))!=42)
  9. Console.WriteLine(n);
  10. }
  11. }
  12.  
C++ (gcc 8.3) klonuj pobierz   
  1. #include <iostream>
  2. using namespace std; // consider removing this line in serious projects
  3.  
  4. int main() {
  5. int intNum = 0;
  6.  
  7. cin >> intNum;
  8. while (intNum != 42) {
  9. cout << intNum << "\n";
  10. cin >> intNum;
  11. }
  12.  
  13. return 0;
  14. }
C++ 4.3.2 (gcc-4.3.2) klonuj pobierz   
  1. #include <iostream>
  2. using namespace std; // consider removing this line in serious projects
  3.  
  4. int main() {
  5. int intNum = 0;
  6.  
  7. cin >> intNum;
  8. while (intNum != 42) {
  9. cout << intNum << "\n";
  10. cin >> intNum;
  11. }
  12.  
  13. return 0;
  14. }
C++14 (gcc 8.3) klonuj pobierz   
  1. #include <iostream>
  2. using namespace std; // consider removing this line in serious projects
  3.  
  4. int main() {
  5. auto func = [] () {
  6. int intNum = 0;
  7. cin >> intNum;
  8. while (intNum != 42) {
  9. cout << intNum << "\n";
  10. cin >> intNum;
  11. }
  12. };
  13. func();
  14.  
  15. return 0;
  16. }
C99 (gcc 8.3) klonuj pobierz   
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x;
  5. for(; scanf("%d",&x) > 0 && x != 42; printf("%d\n", x));
  6. return 0;
  7. }
Clips (clips 6.30) klonuj pobierz   
  1. (defrule readin
  2. ?f<-(initial-fact)
  3. =>
  4. (retract ?f)
  5. (assert (number (read)))
  6. )
  7.  
  8. (defrule writeout
  9. ?f<-(number ?n)(test (<> ?n 42))
  10. =>
  11. (retract ?f)
  12. (printout t ?n crlf)
  13. (assert (initial-fact))
  14. )
  15.  
  16. (reset)
  17.  
  18. (run)
  19.  
  20. (exit)
  21. ; empty line at the end
Clojure (clojure 1.10.0) klonuj pobierz   
  1. (loop [num (read-line)]
  2. (if (= num "42") '() (do (println num) (recur (read-line))))
  3. )
Cobol (gnucobol 2.2.0) klonuj pobierz   
  1. IDENTIFICATION DIVISION.
  2. PROGRAM-ID. IDEONE.
  3.  
  4. ENVIRONMENT DIVISION.
  5.  
  6. DATA DIVISION.
  7. WORKING-STORAGE SECTION.
  8. 77 n PIC Z9 .
  9.  
  10. PROCEDURE DIVISION.
  11. ACCEPT n
  12. PERFORM UNTIL n = 42
  13. DISPLAY n
  14. ACCEPT n
  15. END-PERFORM.
  16. STOP RUN.
  17.  
COBOL 85 (tinycobol-0.65.9) klonuj pobierz   
  1. IDENTIFICATION DIVISION.
  2. PROGRAM-ID. IDEONE.
  3.  
  4. ENVIRONMENT DIVISION.
  5.  
  6. DATA DIVISION.
  7. WORKING-STORAGE SECTION.
  8. 77 n PIC Z9 .
  9.  
  10. PROCEDURE DIVISION.
  11. ACCEPT n
  12. PERFORM UNTIL n = 42
  13. DISPLAY n
  14. ACCEPT n
  15. END-PERFORM.
  16. STOP RUN.
  17.  
Common Lisp (sbcl 1.4.16) klonuj pobierz   
  1.  
Common Lisp (clisp 2.49.92) klonuj pobierz   
  1. (loop
  2. for line = (read-line *standard-input* nil nil)
  3. while (not (equal line "42"))
  4. do (format t "~A~%" line))
D (dmd 2.085.0) klonuj pobierz   
  1. import std.c.stdio;
  2.  
  3. int main() {
  4. int x;
  5. while (scanf("%d", &x) && x!=42) printf ("%d\n", x);
  6. return 0;
  7. }
D (gdc 8.3) klonuj pobierz   
  1.  
Dart (dart 2.3.0) klonuj pobierz   
  1. import 'dart:io';
  2.  
  3. void main() {
  4. while(true) {
  5. String input = stdin.readLineSync();
  6. var n = int.parse(input);
  7. if (n == 42) {
  8. break;
  9. }
  10. print(n);
  11. }
  12. }
Elixir (elixir 1.8.2) klonuj pobierz   
  1. defmodule Main do
  2. def func(:eof) do
  3. end
  4.  
  5. def func(str) do
  6. num = elem(str |> Integer.parse, 0)
  7. if num != 42 do
  8. IO.puts num
  9. func IO.gets("")
  10. end
  11. end
  12.  
  13. def main do
  14. func IO.gets("")
  15. end
  16. end
  17.  
  18. Main.main
  19.  
Erlang (erl 21.3.8) klonuj pobierz   
  1. -module(prog).
  2. -export([main/0]).
  3.  
  4. main() ->
  5. loop().
  6. loop() ->
  7. case io:fread( "","~d" ) of
  8. eof ->
  9. true;
  10. {ok, X} ->
  11. [Y] = X,
  12. if
  13. Y == 42 ->
  14. true;
  15. true ->
  16. io:fwrite( "~B\n",X ),
  17. loop()
  18. end
  19. end.
F# (mono 4.1) klonuj pobierz   
  1. seq { while true do yield stdin.ReadLine () }
  2. |> Seq.takeWhile ((<>) "42")
  3. |> Seq.iter (printfn "%s")
Fantom (fantom 1.0.72) klonuj pobierz   
  1. class FantomSay {
  2. Void main(Str[] args) {
  3.  
  4. while (true) {
  5. str := Env.cur.in.readLine
  6. n := Int.fromStr (str, 10, false)
  7. if (n == 42) {
  8. break;
  9. }
  10. echo(n)
  11. }
  12. }
  13. }
Forth (gforth 0.7.3) klonuj pobierz   
  1. create inbuf 16 chars allot
  2.  
  3. : gobble begin key dup 48 < while drop repeat ;
  4. : readint dup gobble begin dup 47 > while over c! 1+ key repeat drop over - ;
  5. : kthx begin inbuf readint over over s" 42" compare while type cr repeat drop drop ;
  6.  
  7. kthx bye
  8.  
Fortran (gfortran 8.3) klonuj pobierz   
  1. program TEST
  2. integer ans
  3. do
  4. read (*,*) ans
  5. if (ans.eq.42) stop
  6. write (*,*) ans
  7. enddo
  8. stop
  9. end
Go (go 1.12.1) klonuj pobierz   
  1. package main
  2. import "fmt"
  3.  
  4. func main(){
  5. var n int
  6. fmt.Scanf("%d",&n)
  7. for n!=42 {
  8. fmt.Printf("%d\n",n)
  9. fmt.Scanf("%d",&n)
  10. }
  11. }
Gosu (gosu 1.14.9) klonuj pobierz   
  1. uses java.io.InputStreamReader
  2. uses java.util.Scanner
  3. uses java.lang.System
  4.  
  5. var scanner = new Scanner( new InputStreamReader( System.in ) )
  6.  
  7. while (true) {
  8. var n = scanner.nextInt()
  9. if (n == 42) {
  10. break;
  11. }
  12. print( n )
  13. }
Groovy (groovy 2.5.6) klonuj pobierz   
  1. class Ideone {
  2. static void main(String[] args) {
  3. for (line in System.in.readLines()) {
  4. if (line != "42") {
  5. println(line);
  6. } else {
  7. break;
  8. }
  9. }
  10. }
  11. }
  12.  
Haskell (ghc 8.4.4) klonuj pobierz   
  1. main = interact fun
  2.  
  3. fun = unlines . takeWhile (/="42") . words
Icon (iconc 9.5.1) klonuj pobierz   
  1. procedure main()
  2. while write(42 ~= read())
  3. end
Intercal (ick 0.3) klonuj pobierz   
  1. PLEASE DO ,1 <- #1
  2. PLEASE DO .4 <- #0
  3. PLEASE DO .5 <- #0
  4. PLEASE DO .99 <- #0
  5. DO COME FROM (30)
  6. DO COME FROM (31)
  7. DO WRITE IN ,1
  8. DO .1 <- ,1SUB#1
  9. DO .2 <- .4
  10. DO (1000) NEXT
  11. DO .4 <- .3~#255
  12. DO (10) NEXT
  13. (42) DO .1 <- .1
  14. (20) DO .42 <- "&'&.4~#26'$#1"
  15. PLEASE RESUME "?.42$#1"~#3
  16. (10) DO (20) NEXT
  17. DO FORGET #1
  18. PLEASE COME FROM (42)
  19. PLEASE STASH .1+.2+.3
  20. DO .1 <- .4
  21. DO .2 <- #50
  22. DO (1010) NEXT
  23. DO (100) NEXT
  24. PLEASE STASH .1+.2+.3
  25. DO .1 <- .99
  26. DO .2 <- #52
  27. DO (1010) NEXT
  28. DO (101) NEXT
  29. PLEASE GIVE UP
  30. (201) DO .3 <- '.3~.3'~#1
  31. PLEASE RESUME "?.3$#2"~#3
  32. (101) DO (201) NEXT
  33. DO FORGET #1
  34. (32) PLEASE RETRIEVE .1+.2+.3
  35. (200) DO .3 <- '.3~.3'~#1
  36. PLEASE RESUME "?.3$#2"~#3
  37. (100) DO (200) NEXT
  38. DO FORGET #1
  39. DO COME FROM (32)
  40. PLEASE RETRIEVE .1+.2+.3
  41. DO (102) NEXT
  42. (31) DO .99 <- .4
  43. (202) DO .98 <- '.99~.99'~#1
  44. PLEASE RESUME "?.98$#2"~#3
  45. (102) DO (202) NEXT
  46. DO FORGET #1
  47. DO .3 <- !99~#15'$!99~#240'
  48. DO .3 <- !3~#15'$!3~#240'
  49. DO .2 <- !3~#15'$!3~#240'
  50. DO .1 <- .5
  51. DO (1010) NEXT
  52. DO .5 <- .2
  53. DO ,1SUB#1 <- .3
  54. PLEASE READ OUT ,1
  55. (30) DO .99 <- .4
Java (HotSpot 12) klonuj pobierz   
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String s;
  11. while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
  12. }
  13. }
Java (12.0.1) klonuj pobierz   
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String s;
  11. while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
  12. }
  13. }
JavaScript (rhino 1.7.9) klonuj pobierz   
  1. importPackage(java.io);
  2. importPackage(java.lang);
  3.  
  4. var reader = new BufferedReader( new InputStreamReader(System['in']) );
  5.  
  6. while(true) {
  7. var line = reader.readLine();
  8. if(line == null || line == "42") {
  9. break;
  10. } else {
  11. System.out.println(line);
  12. }
  13. }
JavaScript (SMonkey 60.2.3) klonuj pobierz   
  1. while((num = readline()) != 42) {
  2. print(num);
  3. }
Kotlin (kotlin 1.3.21) klonuj pobierz   
  1. import java.util.*
  2.  
  3. fun main(args: Array<String>) {
  4. val sc = Scanner(System.`in`)
  5. while (true) {
  6. val input: String = sc.next()
  7. if (input.trim().toLowerCase() == "42") {
  8. break
  9. }
  10. println(input);
  11. }
  12. }
Lua (luac 5.3.3) klonuj pobierz   
  1. local read, write = io.read, io.write
  2. local num, nl = '*n', '\n'
  3. while true do
  4. local a = read(num)
  5. if a == 42 then return end
  6. write(a, nl)
  7. end
Nemerle (ncc 1.2.547) klonuj pobierz   
  1.  
Nice (nicec 0.9.13) klonuj pobierz   
  1. void main (String[] args)
  2. {
  3. java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
  4. String s;
  5. while (!(s=notNull(r.readLine())).startsWith("42")) System.out.println(s);
  6. }
Nim (nim 0.19.4) klonuj pobierz   
  1. import os
  2. import strutils
  3.  
  4. while true:
  5. var
  6. line:string = stdin.readLine
  7. x = line.parseInt
  8. if x == 42:
  9. break
  10. else:
  11. echo line
Node.js (node 20.14) klonuj pobierz   
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3.  
  4. var remainder = ''
  5. process.stdin.on('data', function (chunk) {
  6. var lines = chunk.toString().split('\n');
  7. lines.unshift(remainder + lines.shift());
  8. remainder = lines.pop();
  9. lines.forEach(function(line) {
  10. if (line === '42') {
  11. process.exit();
  12. }
  13. process.stdout.write(line+'\n');
  14. });
  15. });
Objective-C (gcc 8.3) klonuj pobierz   
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main(int argc, const char * argv[]) {
  4. int a;
  5. while (YES) {
  6. scanf("%d", &a);
  7. if (a == 42) break;
  8. printf("%d\n", a);
  9. }
  10. return 0;
  11. }
Objective-C (clang 8.0) klonuj pobierz   
  1. #import <Foundation/Foundation.h>
  2.  
  3. int main(int argc, const char * argv[]) {
  4. int a;
  5. while (YES) {
  6. scanf("%d", &a);
  7. if (a == 42) break;
  8. printf("%d\n", a);
  9. }
  10. return 0;
  11. }
OCaml (ocamlopt 4.05.0) klonuj pobierz   
  1. while true do
  2. let n = read_int () in
  3. if n = 42 then exit 0;
  4. done;
Octave (octave 4.4.1) klonuj pobierz   
  1. while(true)
  2. x = scanf('%d', [1]);
  3. if (x == 42)
  4. break;
  5. endif
  6. printf("%d\n", x);
  7. endwhile
  8.  
Pascal (gpc 20070904) klonuj pobierz   
  1. program ideone;
  2. var x: integer;
  3. begin
  4. repeat
  5. readln(x);
  6. if x<>42 then writeln(x);
  7. until x=42
  8. end.
Pascal (fpc 3.0.4) klonuj pobierz   
  1. program ideone;
  2. var x:byte;
  3. begin
  4. readln(x);
  5. while x<>42 do
  6. begin
  7. writeln(x);
  8. readln(x)
  9. end
  10. end.
Perl (perl 2018.12) klonuj pobierz   
  1. #!/usr/bin/perl6
  2.  
  3. while (($_ = $*IN.get) != 42) { say $_ }
  4.  
Perl (perl 5.28.1) klonuj pobierz   
  1. #!/usr/bin/perl
  2.  
  3. while (($_=<>)!=42) {print $_;}
PHP (php 7.3.5) klonuj pobierz   
  1. <?php
  2.  
  3. $hi = fopen('php://stdin', "r");
  4. $ho = fopen('php://stdout', "w");
  5.  
  6. while (true) {
  7. fscanf($hi, "%d", $n);
  8. if ($n == 42) break;
  9. fwrite($ho, sprintf("%d\n", $n));
  10. }
  11.  
  12. fclose($ho);
  13. fclose($hi);
Pico Lisp (pico 18.12.27) klonuj pobierz   
  1. (in NIL
  2. (loop
  3. (setq N (format (read)))
  4. (T (= "42" N))
  5. (prinl N))
  6. )
Pike (pike 8.0) klonuj pobierz   
  1. int main() {
  2. string s=Stdio.stdin->gets();
  3. while (s!="42") {
  4. write(s+"\n");
  5. s=Stdio.stdin->gets();
  6. }
  7. return 0;
  8. }
Prolog (swi 7.6.4) klonuj pobierz   
  1. :- set_prolog_flag(verbose,silent).
  2. :- prompt(_, '').
  3. :- use_module(library(readutil)).
  4.  
  5. main:-
  6. process,
  7.  
  8. process:-
  9. read_line_to_codes(current_input, Codes),
  10. ( Codes = end_of_file
  11. -> true
  12. ; ( Codes \= [], number_codes(Int, Codes)
  13. -> (Int is 42
  14. -> true
  15. ; writeln(Int),
  16. process
  17. )
  18. ; true
  19. )
  20. ).
  21.  
  22. :- main.
Prolog (gprolog 1.4.5) klonuj pobierz   
  1. printl_list([H|X]):-
  2. put_code(H), printl_list(X).
  3.  
  4. read_line_codes(A, L) :-
  5. get_code(C),
  6. ( C == -1
  7. -> ( A == []
  8. -> L = end_of_file
  9. ; reverse(A, L)
  10. )
  11. ; ( C == 0'\n
  12. -> reverse(A, L)
  13. ; read_line_codes([C|A], L)
  14. )
  15. ).
  16.  
  17. :- initialization(main).
  18. main :-
  19. repeat,
  20. read_line_codes([], X),
  21. (X == [52,50]
  22. -> (
  23. halt
  24. )
  25. ; (
  26. nl,
  27. printl_list(X)
  28. )),
  29. X == end_of_file,
  30. halt.
Python (cpython 2.7.16) klonuj pobierz   
  1. n = int(raw_input())
  2. while n != 42:
  3. print n
  4. n = int(raw_input())
Python 3 (python  3.12) klonuj pobierz   
  1. from sys import stdin
  2.  
  3. for line in stdin:
  4. n = int(line)
  5. if n == 42:
  6. break
  7. print(n)
  8.  
R (R 3.5.2) klonuj pobierz   
  1. f <- file("stdin")
  2. open(f)
  3.  
  4. while(length(n <- as.integer(readLines(f,n=1))) > 0) {
  5. if (n == 42) {
  6. break;
  7. }
  8. write(n, stdout())
  9. }
Racket (racket 7.0) klonuj pobierz   
  1. (let loop ()
  2. (let/ec break
  3. (define a (read))
  4. (when (= a 42) (break))
  5. (writeln a)
  6. (loop)))
Ruby (ruby 2.5.5) klonuj pobierz   
  1. while (s=gets.chomp()) != "42" do puts s end
Rust (rust 1.56) klonuj pobierz   
  1. use std::io::stdin;
  2. use std::io::BufRead;
  3. use std::io::BufReader;
  4.  
  5. fn main() {
  6. for line in BufReader::new(stdin()).lines() {
  7. match line {
  8. Ok(ref s) if s == "42" => break,
  9. Ok(ref s) => println!("{}", s),
  10. _ => continue
  11. }
  12. }
  13. }
  14.  
Scala (scala 2.12.8) klonuj pobierz   
  1. object Main extends App {
  2. var line = readLine();
  3. while(false == line.equals("42")) {
  4. System.out.println(line);
  5. line = readLine();
  6. };
  7. }
Scheme (chicken 4.13) klonuj pobierz   
  1. (let loop ((number (read)))
  2. (if (= number 42)
  3. (exit)
  4. (begin
  5. (print number)
  6. (loop (read)))))
Scheme (stalin 0.11) klonuj pobierz   
  1.  
Scheme (guile 2.2.4) klonuj pobierz   
  1. (define (do_it n)
  2. (define (print_it n)
  3. (display n)
  4. (newline))
  5. (cond ((not(= n 42))
  6. (print_it n)
  7. (do_it (read)))
  8. ))
  9.  
  10. (do_it (read))
Smalltalk (gst 3.2.5) klonuj pobierz   
  1. |c number|
  2. [
  3. number:=0.
  4. [ (c := stdin next) asciiValue ~= 10 ]
  5. whileTrue:
  6. [number := (number * 10) + (c asciiValue) - 48.].
  7. number ~= 42
  8. ]
  9. whileTrue:
  10. [Transcript show: number printString; cr.]
  11. !
SQLite (sqlite 3.27.2) klonuj pobierz   
  1. create table tbl(str varchar(20));
  2. insert into tbl values('Hello world!');
  3. select * from tbl;
Swift (swift 4.2.2) klonuj pobierz   
  1. while let line = readLine() {
  2. let n = Int(line)
  3. if n == 42 {
  4. break
  5. }
  6. print(n!)
  7. }
TCL (tcl 8.6) klonuj pobierz   
  1. set num [gets stdin]
  2. while { $num != 42 } { puts $num; set num [gets stdin] }
Text (text 6.10) klonuj pobierz   
  1.  
Unlambda (unlambda 0.1.4.2) klonuj pobierz   
  1. ```s``sii`ki
  2. ``s``s`ks
  3. ``s``s`ks``s`k`s`kr
  4. ``s`k`si``s`k`s`k
  5. `d````````````.H.e.l.l.o.,. .w.o.r.l.d.!
  6. k
  7. k
  8. `k``s``s`ksk`k.*
VB.net (mono 4.7) klonuj pobierz   
  1. Imports System
  2.  
  3. Public Class Test
  4. Public Shared Sub Main()
  5. Dim n As Integer
  6. n = Console.ReadLine
  7. Do While n <> 42
  8. System.Console.WriteLine(n)
  9. n = Console.ReadLine
  10. Loop
  11. End Sub
  12. End Class
VB.NET (mono-3.10) klonuj pobierz   
  1. Imports System
  2.  
  3. Public Class Test
  4. Public Shared Sub Main()
  5. Dim n As Integer
  6. n = Console.ReadLine
  7. Do While n <> 42
  8. System.Console.WriteLine(n)
  9. n = Console.ReadLine
  10. Loop
  11. End Sub
  12. End Class
Whitespace (wspace 0.3) klonuj pobierz   
  1.