for example
Code: Select all
test := 1
if (test) msgbox
or
if (test) return <expression>
or
if (test) { <command1>; <command2>; <command3>; return }
Code: Select all
test := 1
if (test) msgbox
or
if (test) return <expression>
or
if (test) { <command1>; <command2>; <command3>; return }
Code: Select all
;SCENARIO 1
(test) && msgbox()
(test) ? msgbox() : 0
;SCENARIO 2
(text) && exit()
(text) ? exit() : 0
ret := 0
(text) && (ret := 1)
(text) ? (ret := 1) : 0
;lower down after multiple 'if' one-liners
if ret
return ret
;also: a big ternary operator could be used
;SCENARIO 3
(test) && (func1(), func2(), func3(), exit())
(test) ? (func1(), func2(), func3(), exit()) : 0
if (test)
return format(retstr, func1(), func2(), func3())
if (test)
return format("", func1(), func2(), func3()) retstr
if (test)
return format(retnum, func1(), func2(), func3())
if (test)
return format(0, func1(), func2(), func3()) + retnum
ret := 0
(test) ? (func1(), func2(), func3(), ret := 1) : 0
(test) && (func1(), func2(), func3(), ret := 1)
;lower down after multiple 'if' one-liners
if ret
return
Code: Select all
<condition> ? <expression>
Code: Select all
<condition> ? <expression> : ""
Code: Select all
;worst (current situation):
if a
{
b(), c(), d()
return
}
else if e
{
f(), g(), h()
return
}
else if i
{
j(), k(), l()
return
}
;==================================================
;best (something like this):
if a then b(), c(), d(), return
else if e then f(), g(), h(), return
else if i then j(), k(), l(), return
;==================================================
;halfway house:
if a
b(), c(), d()
, return
else if e
f(), g(), h()
, return
else if i
j(), k(), l()
, return
Users browsing this forum: No registered users and 71 guests