starscript icon indicating copy to clipboard operation
starscript copied to clipboard

[Suggestion] A way to return erly

Open kybe236 opened this issue 5 months ago • 6 comments

smth so you can return early like {player.get_item(38) != null && player.get_item(38).name != "Elytra" ? break : ""}

kybe236 avatar Jul 26 '25 21:07 kybe236

How would break be different from just returning null or an empy string? And wouldn't it just end up returning null or an emtpy string?

DrParanoya avatar Jul 28 '25 18:07 DrParanoya

i didnt know you could return

kybe236 avatar Jul 28 '25 20:07 kybe236

prob can be closed

kybe236 avatar Jul 28 '25 20:07 kybe236

i didnt know you could return

{"hello"} ^ this expression returns the string "hello" every single starscript expression returns something the empty string at the end of your example gets returned when your boolean expression results in false

DrParanoya avatar Jul 29 '25 09:07 DrParanoya

no like {return early} {this dosn't do anything}

kybe236 avatar Aug 01 '25 17:08 kybe236

no like {return early} {this dosn't do anything}

~~Every expression ({}) returns something. There is no way around that!!! And even if for some reason this was implemented, it would most likely also just return null. And you can already return null.~~

After reading your last message again, you can just use a conditional statement.

DrParanoya avatar Aug 03 '25 08:08 DrParanoya