flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > How to check definition |
Author |
|
Jin X 16 Dec 2020, 09:44
How can I check if 'i' is defined?
Code: define i mov I can't use Code: if defined i Maybe match? But how to use it in this case? |
|||
16 Dec 2020, 09:44 |
|
revolution 16 Dec 2020, 09:46
Code: define i mov match =i,i { display 'i is not defined'} |
|||
16 Dec 2020, 09:46 |
|
DimonSoft 16 Dec 2020, 11:28
Code: match =i , i { rept 0 \{ } match , { display 'i is defined.' } |
|||
16 Dec 2020, 11:28 |
|
revolution 16 Dec 2020, 11:39
Code: define i mov match=i,i{rept 0{}match,{display 'i is defined'} Edit: DimonSoft already posted similar. |
|||
16 Dec 2020, 11:39 |
|
DimonSoft 16 Dec 2020, 22:41
In fact, if the case where something is not defined means an error, one might not need to care about making proper “else” “branch”:
Code: match =i , i { 'Error!' } display 'i is defined.' |
|||
16 Dec 2020, 22:41 |
|
revolution 17 Dec 2020, 04:49
Using irpv might suit better. It can also know of something is defined as itself. But it suffers from a problem of running multiple times if it is defined more than once.
Code: define mov mov irpv x,mov{display 'mov is defined'} |
|||
17 Dec 2020, 04:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.