0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

plunkerでeasyforth その3

Last updated at Posted at 2025-11-21

概要

easyforth、見つけたのでやってみた。
関数集めてみた。

関数

fizzbuzz

: fizzbuzz 100 1 do i 3 mod 0 = i 5 mod 0 = or if i 3 mod 0 = if ." fizz" then i 5 mod 0 = if ." buzz" then else i . then cr loop ;

九九

: kuku 10 1 do 10 1 do i j * . space loop cr loop ;

平方

: SQUARE ( n -- n*n ) DUP * ;

絶対値

: ABS ( n -- |n| ) DUP 0 <  IF NEGATE THEN ;

カウントダウン

: COUNTDOWN ( n -- ) 0 DO I . LOOP ;

フィボナッチ

: fib 7 0 1 rot 0 do swap over + dup . loop ;

ズンドコ、キヨシ

: zundoko 0 begin 2 random if ." zun " 1 + else ." doko " drop 0 then dup 4 = until ." doko kiyoshi!" ;

計時

: time ( word_pointer -- ) utime drop > r execute utime drop r > - 1000 / ." elapsed " . ." ms " cr ;

数値入力

: read-number 0 0 begin swap 10 * + key 48 - dup 0 < until drop ;

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?