# Challenge: Un-Recursive (Simple?)

• (4 Pages)
• « First
• 2
• 3
• 4

## 50 Replies - 20698 Views - Last Post: 18 September 2013 - 04:57 AM

### #46 lucky3

• Friend lucky3 As IHelpable

Reputation: 233
• Posts: 770
• Joined: 19-October 11

## Re: Challenge: Un-Recursive (Simple?)

Posted 05 May 2013 - 12:50 PM

This is my final, and it returns the same as recursive:
Spoiler

• MrCupOfT

Reputation: 2290
• Posts: 9,528
• Joined: 29-May 08

## Re: Challenge: Un-Recursive (Simple?)

Posted 05 May 2013 - 12:52 PM

You sure? Final answer? Do you need to phone a friend?

• MrCupOfT

Reputation: 2290
• Posts: 9,528
• Joined: 29-May 08

## Re: Challenge: Un-Recursive (Simple?)

Posted 05 May 2013 - 01:13 PM

Give lucky3 a Coconut.
Give modi123_1 a Goldfish in a bag.

This post has been edited by AdamSpeight2008: 05 May 2013 - 01:18 PM

• MrCupOfT

Reputation: 2290
• Posts: 9,528
• Joined: 29-May 08

## Re: Challenge: Un-Recursive (Simple?)

Posted 07 May 2013 - 01:41 PM

1 LoC Non-Recursive version.
```Public Function AddWorkDays(d As Date, x As Integer) As Date
Return  d.AddDays(If(x<0, 0, If( d.IsA(Saturday), 2, If( d.IsA(Sunday), 1, 0) ) )+((2* Math.Floor(x * (2/7)))+x))
End Function

```

I'm pretty sure it works. It works for the values I've tried.

### #50 lucky3

• Friend lucky3 As IHelpable

Reputation: 233
• Posts: 770
• Joined: 19-October 11

## Re: Challenge: Un-Recursive (Simple?)

Posted 10 May 2013 - 10:25 AM

I get Saturday (4th of May) as return. For x = -1, it returns Tuesday, April 30th... Am I testing it wrongly with IsA extension?

This post has been edited by lucky3: 10 May 2013 - 10:32 AM

### #51 thava

• D.I.C Lover

Reputation: 180
• Posts: 1,606
• Joined: 17-April 07

## Re: Challenge: Un-Recursive (Simple?)

Posted 18 September 2013 - 04:57 AM