jeudi 23 février 2017

AS3 novice struggles. Can anyone help? thanks

var animal:String ="Cat";

var isFish:Boolean;

isFish = isItAFish(animal);

function isItAFish (animal:String):Boolean {

var fishArray:Array = new Array("haddock", "Trout", "Salmon", "Cod");

for(var i:int = 0; i < fishArray.length; i++){

    if (fishArray[i] == animal){

        return true;

    return false; 

I just need help explaining this code guys and girls. The "isFish = isItAFish (animal); trace(isFish); is where I'm confused from. Thank you

Aucun commentaire:

Enregistrer un commentaire