秘密の 1 つ
JSL If ステートメントは実際には関数であり、値を返します。
print( if ( 1 < 2, "yes", "no" ) )
"はい"
知らなかったら書いたかもしれない
if ( 1 < 2, print("yes"), print( "no" ) )
これも機能します。
秘密 2
JSL If 関数が必要とするのは少なくとも2 つの引数。 3つ以上ある場合もあります! 引数の数が奇数の場合、最後の引数がさもないと価値。
n = 17;
classification = if(
n<3, "toddlers",
n<13, "children",
n<20, "teens",
"adults"
);
show( n, classification );
n = 17;
分類 = "10代";
秘密 3
JSL If 関数は、欠損値を true または false として処理しません。 のさもないと値は答えではありません。
n = .;
classification = if(
n<3, "toddlers",
n<13, "children",
n<20, "teens",
"adults"
);
show( n, classification );
n = .;
分類 = .;
2 つの欠損値が互いに等しいと信じている場合、これは非常に驚くべきことのように思えるかもしれません。 JMP の比較演算子はすべて、どちらか (または両方) のオペランドが欠損値の場合、欠損値を返します。 JMP は isMissing 関数を使用して以下の欠落をテストします。
n = .;
classification = if(
isMissing(n), "unknown",
n<3, "toddlers",
n<13, "children",
n<20, "teens",
"adults"
);
show( n, classification );
n = .;
分類 = "不明";
秘密 4
本当の秘密はない、すべては自分自身にあるウェブ。