Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4233336
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:12:29+00:00 2026-05-21T02:12:29+00:00

with the multiple assignment (ie a,b=b,a) in f# its possible to write Fibonacci in

  • 0

with the multiple assignment (ie a,b=b,a) in f# its possible to write Fibonacci in a single line .. Can some one show how it is .. i know its possible in ruby

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:12:29+00:00Added an answer on May 21, 2026 at 2:12 am

    Scott Hanselman pretty much covers this in this blog post.

    Here is the relevant snippet:

    let rec fib n = if n < 2 then 1 else fib (n-2) + fib(n-1)
    

    Scott got that from Dustin Cambell’s blog. I post Scott’s version because he also has the Ruby code for it. It’s worth noting that in F#, variables are generally immutable so a,b = b,a is not actually reassigning anything (I don’t think it’s even valid syntax). Rather, a function like let swap (a,b) = (b,a) is taking a tuple and returning a new tuple with the contents reversed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Tuple parameter declaration and assignment oddity In Scala, one can do multiple-variable
PHP has a language construct list() which provides multiple variables assignment in one statement.
I've got an assignment to write a server program that accepts multiple clients. I'm
Are there any advantages or disadvantages to using multiple assignment in a statement? In
The textbook examples of multiple unpacking assignment are something like: import numpy as NP
Just to clarify, when I say multiple assigment, parallel assignment, destructuring bind I mean
Multiple NSURLConnections being started (in a single UIViewController) to gather different kinds of data.
multiple webapp running on same tomcat using same jvm. sometime, one webapp that have
Multiple sites have buttons where you can tweet, digg, etc. On this page you'll
Handling multiple merges onto branches in Subversion or CVS is just one of those

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.