Level 4 Triangles: where to start

I’ve been trying my best but I just feel like I’m going backwards, and just not grasping it. This is what I have so far to start:

// Create a function call `determine_triangle_type`.
// It should have three inputs for the three sides of the triangle
// It must return "invalid", "equilateral", "isosceles" or "scalene".

function determine_triangle_type with number do
  set side1 to number
  set side2 to number
  set side3 to number
  if side1==0 and side2==0 and side3==0 do
    return "invalid"
  end
end

I keep getting this error: " Jiki tried to run the determine_triangle_type function but it had a different amount of inputs to what he expected."

Am I at least on the right track? I thought at least 3 inputs would be needed, and I tried it without the extra number input. I would like to finish one of these harder ones without having to go to the Labs video for help. I feel like once I watch the video I get it, but I can’t solve it on my own.

1 Like

When you define the function (the function line), you can use with to define one or more inputs. Currently your function takes a single input, number. You then set all three sides to the same input.

Instead, the function should have three inputs. You could name them, say, side1, side2, side3.

Does that help?

1 Like

That does make it a bit clearer! I’ll start with that and see how it goes. Thank you!

2 Likes

This is a great approach!

It’s often more fruitful to ask us for help here or on discord so we can help you ask the right questions. You’ll also feel more empowered.

…but please don’t be stuck for days! :hugs::chart_with_upwards_trend:

2 Likes