
Quote from s7shanbe on January 20, 2023, 4:33 pmhello
What is the easiest way to find the
Maximum number Among of several numbers?
hello
What is the easiest way to find the
Maximum number Among of several numbers?

Quote from YASIN on January 20, 2023, 4:50 pmسلام هموطن
این اعداد رو میخوای کجا وارد کنی ؟
یا اینکه کجا وارد شده که میخوای تشخیص بدی ؟
توی متغیره ؟ توی تکست اینتری ؟
اگر میشه یه نمونه بزار شاید بتونم کمکت کنم
Hello fellow countryman
Where do you want to enter these numbers?
Or where is it entered that you want to recognize?
Is it in the variable? In the text entry?
If possible, give an example, maybe I can help you
سلام هموطن
این اعداد رو میخوای کجا وارد کنی ؟
یا اینکه کجا وارد شده که میخوای تشخیص بدی ؟
توی متغیره ؟ توی تکست اینتری ؟
اگر میشه یه نمونه بزار شاید بتونم کمکت کنم
Hello fellow countryman
Where do you want to enter these numbers?
Or where is it entered that you want to recognize?
Is it in the variable? In the text entry?
If possible, give an example, maybe I can help you

Quote from s7shanbe on January 20, 2023, 5:01 pmسلام یاسین
بزرگترین عدد باید از بین چند متغیر انتخاب شود.Hello @yasin
The largest number must be selected from among several variables.
سلام یاسین
بزرگترین عدد باید از بین چند متغیر انتخاب شود.
Hello @yasin
The largest number must be selected from among several variables.

Quote from roccocogliano on January 20, 2023, 5:28 pmTry this in a button:
SetVar [a] 12
setvar [b] 1
setvar [c] 22
setvar [d] 3
SetVar [e] 5
SetVar [numbers] "[a],[b],[c],[d],[e]"
StrParse "[numbers]" "," [myArray]
ArrayNumSort [myArray]
ArrayReverse [myArray]
setvar [max] [myArray(0)]
The variable [max] is the maximum
Try this in a button:
SetVar [a] 12
setvar [b] 1
setvar [c] 22
setvar [d] 3
SetVar [e] 5
SetVar [numbers] "[a],[b],[c],[d],[e]"
StrParse "[numbers]" "," [myArray]
ArrayNumSort [myArray]
ArrayReverse [myArray]
setvar [max] [myArray(0)]
The variable [max] is the maximum

Quote from s7shanbe on January 20, 2023, 5:48 pm@roccocogliano
ArrayNumSort and ArrayReverse
cannot be used in neobook.Can getarrayinfo be used?
ArrayNumSort and ArrayReverse
cannot be used in neobook.
Can getarrayinfo be used?

Quote from roccocogliano on January 20, 2023, 6:05 pmsorry, I hadn't seen that it was visualneo win
sorry, I hadn't seen that it was visualneo win

Quote from roccocogliano on January 20, 2023, 6:16 pmthen you have to loop through arrays and whenever you find a number that is bigger than the maximum found in the previous loop you replace it. in js it would be like this:
function findMax(arr) {
let max = arr[0];
for (let i = 1; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
return max;
}Where arr it's the array that contain numbers
convert it to visual neo win.
then you have to loop through arrays and whenever you find a number that is bigger than the maximum found in the previous loop you replace it. in js it would be like this:
function findMax(arr) {
let max = arr[0];
for (let i = 1; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
return max;
}
Where arr it's the array that contain numbers
convert it to visual neo win.
Quote from Gaev on January 20, 2023, 7:31 pm@s7shanbe
Can getarrayinfo be used?
No, this command returns the item position (1st, 3rd etc.) of the numbers of the highest/lowest items with a non-null value; so, e.g. if you had 10 items, and you removed/deleted the first and last two items, this command would return 2 and 8.
But, using parts of script posted by @roccocogliano , you can still meet your requirement using just VisualNeoWin scripts ...
SetVar "[a]" "12" setvar "[b]" "1" setvar "[c]" "22" setvar "[d]" "3" SetVar "[e]" "5" SetVar "[numbers]" "[a],[b],[c],[d],[e]" StrParse "[numbers]" "," "[myArrayItems]" "[myArrayCount]" SetVar "[maxNumber]" "[myArrayItems1]" ... loop through rest of items to find largest number Loop "2" "[myArrayCount]" "[thisArrayItemNumber]" SetVar "[thisArrayItemValue]" "[myArrayItems[thisArrayItemNumber]]" If "[thisArrayItemValue]" ">" "[maxNumber]" SetVar "[maxNumber]" "[thisArrayItemValue]" EndIf EndLoop AlertBox "maxnumber" "[maxNumber]"
Can getarrayinfo be used?
No, this command returns the item position (1st, 3rd etc.) of the numbers of the highest/lowest items with a non-null value; so, e.g. if you had 10 items, and you removed/deleted the first and last two items, this command would return 2 and 8.
But, using parts of script posted by @roccocogliano , you can still meet your requirement using just VisualNeoWin scripts ...
SetVar "[a]" "12"
setvar "[b]" "1"
setvar "[c]" "22"
setvar "[d]" "3"
SetVar "[e]" "5"
SetVar "[numbers]" "[a],[b],[c],[d],[e]"
StrParse "[numbers]" "," "[myArrayItems]" "[myArrayCount]"
SetVar "[maxNumber]" "[myArrayItems1]"
... loop through rest of items to find largest number
Loop "2" "[myArrayCount]" "[thisArrayItemNumber]"
SetVar "[thisArrayItemValue]" "[myArrayItems[thisArrayItemNumber]]"
If "[thisArrayItemValue]" ">" "[maxNumber]"
SetVar "[maxNumber]" "[thisArrayItemValue]"
EndIf
EndLoop
AlertBox "maxnumber" "[maxNumber]"