Putting a Test or Condition on the Right-Hand Side of a Function
- To: mathgroup at smc.vnet.net
- Subject: [mg127461] Putting a Test or Condition on the Right-Hand Side of a Function
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Thu, 26 Jul 2012 03:35:45 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
Hello everyone, I have a simple function that displays the integer part of a real number if the fraction part is less than a millionth. dropDecimal[x_] := If[FractionalPart[x] < .000001, IntegerPart[x], x] In trying to learn more about functional programming, I was wondering whether there is a way to put the condition or test on the right-hand side of the function. Gregory