• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Challenge: Algorithms having only one line of code. Ralph Senior Member Posts: 544 Threads: 27 Joined: Jan 2005 03-28-2006, 08:05 AM Moneo: Here's another one-liner to turn a switch on and off, in accordance with, and I quote you, "Most programmers consider TRUE as -1, and FALSE as 0." x = -1 - x Starting with x = 0, the next time it encounters the above, the new value will be, x = - 1, then, x = 0, then, x = -1, and so on... In other words, as long as the previous value of x is 0 or -1, the one-liner will toggle the value of x to either -1 or 0, etc. Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer. « Next Oldest | Next Newest »

 Messages In This Thread Challenge: Algorithms having only one line of code. - by Moneo - 06-24-2003, 06:32 AM Challenge: Algorithms having only one line of code. - by na_th_an - 06-24-2003, 07:17 AM Challenge: Algorithms having only one line of code. - by Moneo - 06-24-2003, 09:28 AM Challenge: Algorithms having only one line of code. - by seph - 06-24-2003, 10:06 AM Challenge: Algorithms having only one line of code. - by oracle - 06-24-2003, 10:06 AM Challenge: Algorithms having only one line of code. - by Moneo - 06-24-2003, 10:33 AM Challenge: Algorithms having only one line of code. - by Agamemnus - 06-24-2003, 06:43 PM To Oracle: 2nd look at your code. - by Moneo - 06-24-2003, 09:07 PM To Seph and Agamemnus: - by Moneo - 06-24-2003, 09:17 PM factorial. - by Agamemnus - 06-24-2003, 09:51 PM To Agamemnus - by Moneo - 06-24-2003, 10:21 PM Challenge: Algorithms having only one line of code. - by Moneo - 06-25-2003, 10:43 PM Challenge: Algorithms having only one line of code. - by Antoni Gual - 06-25-2003, 11:30 PM Challenge: Algorithms having only one line of code. - by Moneo - 06-26-2003, 12:16 AM Challenge: Algorithms having only one line of code. - by Antoni Gual - 06-26-2003, 02:12 AM Challenge: Algorithms having only one line of code. - by Moneo - 06-26-2003, 02:33 AM Challenge: Algorithms having only one line of code. - by Antoni Gual - 06-26-2003, 02:55 AM Challenge: Algorithms having only one line of code. - by Agamemnus - 06-26-2003, 06:15 AM Challenge: Algorithms having only one line of code. - by seph - 06-26-2003, 09:57 AM Challenge: Algorithms having only one line of code. - by na_th_an - 06-26-2003, 05:59 PM Challenge: Algorithms having only one line of code. - by Moneo - 06-26-2003, 09:06 PM Challenge: Algorithms having only one line of code. - by Moneo - 06-26-2003, 11:57 PM Challenge: Algorithms having only one line of code. - by na_th_an - 06-27-2003, 12:53 AM To na_th_an: - by Moneo - 06-27-2003, 03:15 AM Challenge: Algorithms having only one line of code. - by oracle - 06-27-2003, 12:57 PM Challenge: Algorithms having only one line of code. - by LooseCaboose - 06-27-2003, 01:55 PM ok, - by Agamemnus - 06-27-2003, 05:17 PM To Oracle re Statlib - by Moneo - 06-27-2003, 10:39 PM Re: To na_th_an: - by na_th_an - 06-28-2003, 01:14 AM Challenge: Algorithms having only one line of code. - by Moneo - 06-28-2003, 02:30 AM To LooseCaboose: - by Moneo - 06-28-2003, 03:08 AM Challenge: Algorithms having only one line of code. - by LooseCaboose - 06-28-2003, 05:45 AM Re: To Oracle re Statlib - by oracle - 06-28-2003, 05:50 AM Challenge: Algorithms having only one line of code. - by Moneo - 06-28-2003, 07:04 AM Challenge: Algorithms having only one line of code. - by na_th_an - 06-28-2003, 09:12 AM Challenge: Algorithms having only one line of code. - by oracle - 06-28-2003, 11:07 AM To Oracle: - by Moneo - 06-29-2003, 03:10 AM Challenge: Algorithms having only one line of code. - by ak00ma - 06-29-2003, 02:29 PM Challenge: Algorithms having only one line of code. - by Ninkazu - 06-29-2003, 11:02 PM Challenge: Algorithms having only one line of code. - by ak00ma - 06-30-2003, 12:53 AM Challenge: Algorithms having only one line of code. - by DrV - 06-30-2003, 01:01 AM To Ak00ma: - by Moneo - 06-30-2003, 03:39 AM Challenge: Algorithms having only one line of code. - by DrV - 06-30-2003, 04:07 AM Challenge: Algorithms having only one line of code. - by oracle - 06-30-2003, 04:53 AM Challenge: Algorithms having only one line of code. - by Moneo - 06-30-2003, 07:35 AM Challenge: Algorithms having only one line of code. - by oracle - 06-30-2003, 09:42 AM Challenge: Algorithms having only one line of code. - by ak00ma - 06-30-2003, 08:35 PM Challenge: Algorithms having only one line of code. - by DrV - 07-01-2003, 09:33 AM Challenge: Algorithms having only one line of code. - by oracle - 07-01-2003, 11:30 AM Power of 2 - by Moneo - 07-02-2003, 02:42 AM Challenge: Algorithms having only one line of code. - by Antoni Gual - 07-02-2003, 02:53 AM To Antoni: - by Moneo - 07-02-2003, 03:03 AM Challenge: Algorithms having only one line of code. - by Antoni Gual - 07-02-2003, 03:15 AM Challenge: Algorithms having only one line of code. - by na_th_an - 07-02-2003, 03:25 AM Challenge: Algorithms having only one line of code. - by oracle - 07-02-2003, 07:28 AM Challenge: Algorithms having only one line of code. - by BinarySHOCK - 07-02-2003, 11:10 AM 197 - by whitetiger0990 - 07-02-2003, 06:29 PM To na_th_an re "replacement" logic: - by Moneo - 07-02-2003, 08:29 PM Re ROUNDING using .5: - by Moneo - 07-02-2003, 08:47 PM Challenge: Algorithms having only one line of code. - by whitetiger0990 - 07-02-2003, 08:58 PM Re: Re ROUNDING using .5: - by Moneo - 03-20-2006, 06:19 AM Challenge: Algorithms having only one line of code. - by Dr_Davenstein - 03-20-2006, 10:09 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-21-2006, 01:04 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-21-2006, 01:20 AM Challenge: Algorithms having only one line of code. - by Ralph - 03-21-2006, 03:24 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-21-2006, 08:07 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-21-2006, 08:10 AM Re: Challenge: Algorithms having only one line of code. - by Ralph - 03-21-2006, 08:19 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-22-2006, 09:35 AM Challenge: Algorithms having only one line of code. - by Nemesis - 03-27-2006, 06:11 PM Challenge: Algorithms having only one line of code. - by Moneo - 03-28-2006, 12:55 AM Challenge: Algorithms having only one line of code. - by Ralph - 03-28-2006, 08:05 AM Challenge: Algorithms having only one line of code. - by na_th_an - 03-28-2006, 07:02 PM Challenge: Algorithms having only one line of code. - by Dr_Davenstein - 03-29-2006, 03:30 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-29-2006, 05:56 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-29-2006, 06:41 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-29-2006, 06:45 AM Challenge: Algorithms having only one line of code. - by na_th_an - 03-29-2006, 05:01 PM Challenge: Algorithms having only one line of code. - by yetifoot - 03-29-2006, 09:57 PM Challenge: Algorithms having only one line of code. - by Anonymous - 03-29-2006, 10:09 PM Challenge: Algorithms having only one line of code. - by yetifoot - 03-29-2006, 10:19 PM Challenge: Algorithms having only one line of code. - by Anonymous - 03-29-2006, 10:24 PM Challenge: Algorithms having only one line of code. - by yetifoot - 03-29-2006, 10:46 PM Challenge: Algorithms having only one line of code. - by Anonymous - 03-29-2006, 10:52 PM my one-liner - by neuro - 03-30-2006, 12:08 AM Challenge: Algorithms having only one line of code. - by Antoni Gual - 03-30-2006, 12:13 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-30-2006, 01:26 AM Challenge: Algorithms having only one line of code. - by relsoft - 03-30-2006, 07:24 AM Challenge: Algorithms having only one line of code. - by Moneo - 03-31-2006, 04:52 AM Challenge: Algorithms having only one line of code. - by relsoft - 03-31-2006, 11:09 AM Challenge: Algorithms having only one line of code. - by Ralph - 04-01-2006, 01:20 AM Challenge: Algorithms having only one line of code. - by Moneo - 04-01-2006, 07:06 AM Challenge: Algorithms having only one line of code. - by yetifoot - 04-01-2006, 07:28 PM Challenge: Algorithms having only one line of code. - by yetifoot - 04-26-2006, 08:04 PM Challenge: Algorithms having only one line of code. - by Moneo - 04-27-2006, 05:49 AM Challenge: Algorithms having only one line of code. - by yetifoot - 04-27-2006, 09:37 PM Challenge: Algorithms having only one line of code. - by Antoni Gual - 05-03-2006, 10:55 PM Challenge: Algorithms having only one line of code. - by yetifoot - 05-05-2006, 05:01 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)