It is unclear if you are trying (1) to print the |vectorX|
has more than one element, or (2) if a specific author appears more than once in the vector.
If this is the first option, you can use tube
of size()
, and in that case the code would be: (ref: Tube Size)
if(|vectorX|.size() == 1) {
print "vem"
}
else {
print "vêm"
},
Of course for this case where the only thing you want to do is to print a different value for each condition, the Tube Printif is more appropriate and summarized, and would look like this:
print printIf(|vectorX|.size() == 1, "vem", "vêm"),
Now if it’s the second option, I need to understand better what the struct
that you are using for your vector, to direct you the best response.
But let’s say your struct is something like:
struct[Test] {
name = "Test"
request = "Test"
fields {
+[numAutor]: Integer,
+[a]: String,
+[b]: Currency
}
}
And the declaration of its vector +|vectorAutores|: Vector[Test]
. In this case, if you want to know how many times the author with a specific code appears in the vector, you need to use the Tube Filter, to filter all vector elements with this specific number, save to another vector, say the vector +|filtrado|: Vector[Test]
and see the amount of elements of that result, using the size()
:
|filtrado| = |vectorAutores|.filter([this.numAutor] == 1),
print printIf(|filtrado|.size() == 1, "vem", "vêm"),