-
Notifications
You must be signed in to change notification settings - Fork 91
Integer arithmetic
CodingUnit edited this page Nov 30, 2011
·
4 revisions
-
Category: Arithmetic
-
Description: This sample shows some basic integer arithmetic in addition to tuple usage.
-
Code:
using Console;
using System.Console;
def x = 5 + 8 - 3;
def y = x * 3 + 5;
def (r1, r2) = (x / 3, x % 3); //this tuple declaration binds the first element of the tuple to r1 and the second to r2
WriteLine($"x = $x, y = $y, r1 = $r1, r2 = $r2")
- Execution Result:
x = 10, y = 35, r1 = 3, r2 = 1
- Copyright
Samples used from “F# 3.0 Sample Pack” (http://fsharp3sample.codeplex.com/) at Codeplex OpenSource Community for non-commercial usage. All copyrights and authorship on materials this publication based on, is belongs to Microsoft corp. Copyright © 2006-2011 Microsoft Corporation, . All rights reserved. Copyright and autorship for materials in Nemerle language belongs to Nemerle Project Team. Copyright © 2008-2011 Nemerle Project Team. All rights reserved.