comment=$comment
is like
"where item comment is = to the (same) item comment", and obviously is true for all items, so all items are returned.
Thank you!
Is not one "Unexpected behavior", it is always idiotic to call variables with the same name as fields, and this is true in all programming languages(*).
Is it now?
Let's see:
Python:
the_parameter = "value"
def the_method(the_parameter):
print(f"Value is: {the_parameter}")
the_method(the_parameter=the_parameter)
Ruby:
the_parameter = "value"
def the_method(the_parameter)
puts "Value is: #{the_parameter}"
end
the_method(the_parameter: the_parameter)
Kotlin:
fun theMethod(theParameter: String) {
println("Value is: $theParameter")
}
val theParameter = "value"
fun main() {
theMethod(theParameter = theParameter)
}
C#:
using System;
class Program {
static void Main() {
string theParameter = "value";
TheMethod(theParameter: theParameter);
}
static void TheMethod(string theParameter) {
Console.WriteLine($"Value is: {theParameter}");
}
}
Swift:
func theMethod(theParameter: String) {
print("Value is: \(theParameter)")
}
let theParameter = "value"
theMethod(theParameter: theParameter)
PHP:
function theMethod($theParameter) {
echo "Value is: $theParameter";
}
$theParameter = "value";
theMethod(theParameter: $theParameter);
Scala:
object Main extends App {
def theMethod(theParameter: String): Unit = {
println(s"Value is: $theParameter")
}
val theParameter = "value"
theMethod(theParameter = theParameter)
}
PowerShell:
function TheMethod {
param([string]$theParameter)
Write-Host "Value is: $theParameter"
}
$theParameter = "value"
TheMethod -theParameter $theParameter
R:
theMethod <- function(theParameter) {
cat("Value is:", theParameter, "\n")
}
theParameter <- "value"
theMethod(theParameter = theParameter)
Lisp:
(defun the-method (&key the-parameter)
(format t "Value is: ~A~%" the-parameter))
(let ((the-parameter "value"))
(the-method :the-parameter the-parameter))
Ada:
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
the_parameter : String := "value";
procedure The_Method (the_parameter : String) is
begin
Put_Line ("Value is: " & the_parameter);
end The_Method;
begin
The_Method (the_parameter => the_parameter);
end Main;
All seem to work just fine... But I guess, you learn something new every day