-
Notifications
You must be signed in to change notification settings - Fork 89
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 ©](Terms of use, legal notice)