[[https://www.revelation.com/|Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community]] ==== Arithmatic Operands (AREV Specific) ==== === At 29 JAN 2009 02:12:01PM Terry Rainville wrote: === {{tag>"AREV Specific"}} Hello All, Arithmatic Operations Substitution Eg Val Operator Val 10 * 10 10 / 10 10 - 10 10 + 10 Operand=*' Ans=Val1 Operand Val2 How do I use a variable as the operand instead of actully putting the operand in the equation. I solved this using a Case statement but I wanted to know if there is a way to do this in one line of code where the Operand Variable just changes. Thanks!!! ---- === At 30 JAN 2009 12:49PM Victor Engel wrote: === I don't think there is a way to do this. I'm curious what application would benefit from such a scheme. ---- === At 30 JAN 2009 09:11PM S Smith wrote: === One way is to write a symbolic (maybe in voc), use dictcompile, run calculatex, and then call the function name stored in a variable @functionname(x,y) etc... I once wrote an interpreter program to do this on a screen so that you could write and resolve formulae on the fly. ---- === At 02 FEB 2009 01:52PM Terry Rainville wrote: === Victor Val1 Operand Val2 Would be alot easier than Operand=*' begin case case Operand=*' ; Val1 * Val2 case Operand=/' ; Val1 / Val2 case Operand=+' ; Val1 + Val2 case Operand=-' ; Val1 - Val2 end case And this could be used in any application where you want to allow arithmatic operations on Values by the users. Point being I dont want to have to code the same line of code 4 times in a case statement when I could do it in 1 line if it is possible. ---- === At 02 FEB 2009 04:10PM Victor Engel wrote: === I understand what you're trying to do. I just am trying to get a feel for why? The only things I can think of off the top of my head that would benefit from such a thing would be calculator or spreadsheet programs. Anyway, I think the operators must be evaluated at compile time, not run time, which is why the functionality you want doesn't exist. [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=D37CF52681F64ABE8525754D0069789B|View this thread on the forum...]]