fork download
  1. 32 constant #size
  2. create numero #size chars allot
  3.  
  4. : saccept 1 - swap 1 + swap accept ;
  5.  
  6. : lerNumero ( end -- )
  7. dup #size saccept swap c! ;
  8.  
  9. : whileNot42 ( -- )
  10. -1
  11. begin
  12. while
  13. numero lerNumero
  14. numero count
  15. swap drop
  16. 0 <> if
  17. numero number drop \ Converte a string para inteiro e remove o
  18. status da stack, deixando
  19. \ apenas o numero na stack
  20. dup
  21. 42 = if
  22. drop 0
  23. else
  24. . cr
  25. -1
  26. then
  27. else
  28. -1 cr
  29. then
  30. repeat
  31. ;
  32. whileNot42
Success #stdin #stdout 0.01s 7504KB
stdin
1

2

88

42

99
stdout