Skip to content
Discussion options

You must be logged in to vote

But doing that raises error like following:

It needs to be the same let arr = as before, there is no naked assignment in Mint.

  1. You return the original array in the elsebranch:
let arr = 
  if result1 == "small" {
    Array.push(arr, "mini")
  } else {
    arr
  }
  1. You can use pipes to make that nicer:
let arr =
  []
  |> Array.push(myFunc1)
  |> Array.push(myFunc2)
  |> Array.push(myFunc3)

which is the same as:

Array.push(Array.push(Array.push([], myFunc1), myFunc2), myFunc3)
  1. There is no early return like that, you need to handle the else branch correctly:
let arr = []
let result1 = myFunc1

if result1 == <something_unwanted> {
  arr
} else {
  Array.push(arr, result1)
}

OK. But w…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jiggneshhgohel
Comment options

@gdotdesign
Comment options

Answer selected by jiggneshhgohel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants