How to Humanize Numerical Input|Output

2024-09-09 Thread Jabari Zakiya via Digitalmars-d-learn
I have this code to input integer values: ``` ulong[] x; foreach (_; 0 .. 2) { ulong a; readf!" %d"(a); x ~= a; } end_num = max(x[0], 3); start_num = max(x[1], 3); if (start_num > end_num) swap(start_num, end_num); start_num = start_num | 1; // if start_num even add 1 e

Re: Input/Output multiple values from function

2019-09-02 Thread Jabari Zakiya via Digitalmars-d-learn
On Sunday, 1 September 2019 at 20:50:42 UTC, Paul Backus wrote: On Sunday, 1 September 2019 at 20:42:28 UTC, Jabari Zakiya wrote: It still won't compile, with this error. Error: AliasSeq!(modpg, res_0, restwins, resinvrs) is not an lvalue and cannot be modified Here's a gist of the code. To

Re: Input/Output multiple values from function

2019-09-01 Thread Jabari Zakiya via Digitalmars-d-learn
On Thursday, 29 August 2019 at 10:58:47 UTC, Simen Kjærås wrote: On Thursday, 29 August 2019 at 10:39:44 UTC, Jabari Zakiya wrote: [...] Great - then you can use shared(immutable(uint)[]). You should be able to convert from immutable(uint[]) to that without issue. There's a utility function

Re: Input/Output multiple values from function

2019-08-29 Thread Jabari Zakiya via Digitalmars-d-learn
On Thursday, 29 August 2019 at 09:04:17 UTC, Simen Kjærås wrote: On Wednesday, 28 August 2019 at 13:11:46 UTC, Jabari Zakiya wrote: [...] Reduced example: unittest { int[] a; // cannot implicitly convert expression a of type int[] to shared(int[]) shared int[] b = a; } This is

Re: Input/Output multiple values from function

2019-08-28 Thread Jabari Zakiya via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 10:10:08 UTC, Simen Kjærås wrote: On Wednesday, 28 August 2019 at 05:17:28 UTC, Jabari Zakiya wrote: Inside func2 I create an input value for func1 and then assign func1's 4 outputs to named variable. That's where the problems arise. func1 does some math based on

Re: Input/Output multiple values from function

2019-08-27 Thread Jabari Zakiya via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 04:39:23 UTC, Mike Parker wrote: On Wednesday, 28 August 2019 at 04:19:49 UTC, Jabari Zakiya wrote: I have a function (say func1) that takes 1 input value (an integer number) and outputs 4 values (2 integers and 2 arrays of integers). Then inside another functi

Input/Output multiple values from function

2019-08-27 Thread Jabari Zakiya via Digitalmars-d-learn
I have a function (say func1) that takes 1 input value (an integer number) and outputs 4 values (2 integers and 2 arrays of integers). Then inside another function (say func2) I provide the 1 input to func1 and then want to assign its 4 output values to their appropriate final variables that