November 28, 2020, 10:14:36 AM

Author Topic: [bmx] tiny factorial function by Warpy [ 1+ years ago ]  (Read 657 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bmx] tiny factorial function by Warpy [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
Title : tiny factorial function
Author : Warpy
Posted : 1+ years ago

Description : [a href=http://twitter.com/blitzbasic]The official blitzbasic twitter account[/a] had a request for a blitz program that fits in a tweet (140 characters)

This little factorial function occurred to me - it's only 47 characters! It takes advantage of the fact that True is the same as the number 1 in bmax


Code :
Code: BlitzMax
  1. Function f(n)
  2. Return n=1 Or n*f(n-1)
  3. End Function


Comments :


Nate the Great(Posted 1+ years ago)

 wow thats pretty um small.  It may be useful though.


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal