Advertisement

switch return bug

Started by July 19, 2012 02:23 PM
0 comments, last by WitchLord 12 years, 4 months ago
hi, i think i found a bug with a switch and return statements
asscript:
[source lang="cpp"] bool onEvent()
{
switch(1)
{
case 1:
return true;
default:
return false;
}
}[/source]

error:
objects/Controller.as (54, 2) : INFO : Compiling bool Controller::onEvent()
objects/Controller.as (55, 2) : ERR : Not all paths return a value

but that isnt true. maybe return statements are not supported in switch cases. if so this is a feature request:)

thx
The switch statement currently doesn't have the logic to check if all possible paths have a return statement. I'll look into implementing it.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement