Difference between revisions of "ASH Errors"

From Kolmafia
Jump to navigation Jump to search
imported>Slyz
(someone might want to check the formatting)
imported>Slyz
m
Line 8: Line 8:
  
 
{{CodeSample|
 
{{CodeSample|
description=Example|
+
description=Example:|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 20: Line 20:
  
 
{{CodeSample|
 
{{CodeSample|
description=Example|
+
description=Example:|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 27: Line 27:
 
</syntaxhighlight>}}
 
</syntaxhighlight>}}
 
will cause this error: <span style="color:red">Expected ;, found print (test.ash, line 2)</span>
 
will cause this error: <span style="color:red">Expected ;, found print (test.ash, line 2)</span>
 
  
 
===Missing return value===
 
===Missing return value===
Line 34: Line 33:
  
 
{{CodeSample|
 
{{CodeSample|
description=Example|
+
description=Example:|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>

Revision as of 17:35, 16 April 2010

Errors happen.

Also, I don't happen to have this page done, yet.

Abort

Whenever a script runs the abort() function, this error is generated.

Example:

abort("Aborting script...");

will stop the execution and print: Aborting script...

Expected

This generally indicates a syntax problem (missing ending semi-colon, unmatched braces, unmatched parenthesis etc...).

Example:

int a = 1
print(a);

will cause this error: Expected ;, found print (test.ash, line 2)

Missing return value

The last line of a user-defined function has to be "return <value>;" (although the return command can be used before too).

Example:

int my_function( int a, int b ) {	
    if ( a > b ) return a ;
    else return b ;
}

will cause this error: Missing return value (test.ash, line 4)

Attention KoLmafia Experts!

We need your help; some details of this function's operation are unknown or unclear.

The following specific question has been raised:

  • Obviously, a lot more info is needed here.