ByRef - Default value - is it possible at the same time?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Albireo
Posts: 1774
Joined: 16 Oct 2013, 13:53

ByRef - Default value - is it possible at the same time?

11 May 2024, 04:34

ByRef - Seems to have become more possibilities to handle values from functions()
eg.

But is there any way to handle default values at the same time?

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force

tstDef(&A, &B)
MsgBox A "," B "," val3

tstDef(&val1, &val2, val3:="Yes!")
{
    val1 := "A"
    val2 := 100
	 %val3% := val3
    Return
}
(I have never seen the instruction %val3% := 1.1 before)
Rohwedder
Posts: 7718
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: ByRef - Default value - is it possible at the same time?

12 May 2024, 11:44

Hallo,
try:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force

A := 1, B:= 2, Yes := "No"
tstDef(&A, &B)
MsgBox A "," B "," Yes ; A,100,Yes

tstDef(&val1, &val2, val3:="Yes")
{
    Global
	val1 := "A"
    val2 := 100
	 %val3% := val3
}
Regarding %val3% := val3 see https://www.autohotkey.com/docs/v2/Variables.htm#deref

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Xeilous and 25 guests