
步驟 2. 建立 input / output parameters,num1 與 num2 是供輸入的兩個整數參數,operator 是輸入加減乘除用的參數,result 是運算結果

步驟 3. 在 MathFlow 中,建立一個 branch step,依照 operator 參數所輸入的值來做不同的處理

步驟 4. 依據不同的 operator 使用不同的套件,即 pub.math:addInts, pub.math:subtractInts, pub.math:multiplyInts, pub.math:divideInts,Label 的值代表是 operator 所輸入的值

步驟 5. 在 pipeline tab 拉 pub.math:addInts, pub.math:subtractInts, pub.math:multiplyInts, pub.math:divideInts 對應的值




步驟 6. 若 operator 輸入非預期的字元,則要做額外的處理,label 設定為 $default,並設定印出 The operator is invalid 此警告訊息


步驟 7. 若 operator 沒有輸入值,,則要做額外的處理,label 設定為 $null,並設定印出 The operator is null 此警告訊息


執行結果

No comments:
Post a Comment