Reputation: 346
I would like to achieve something like this:
se <- .Primitive("if")
senao <- .Primitive("else") # I get an error here
para <- .Primitive("if")
# The code I would like to run
se (1 == 1){
# Some code
} senao {
#more code
}
# This also doesn't work
para(1 in 1:3)
{
print(i)
}
I would like to use the mechanism above to teach children who don't know how to speak English yet how to program. Thanks in advance.
Upvotes: 3
Views: 96
Reputation: 206401
Nope. This is not possible in R. The parser has special cases for certain keywords. They cannot be changed (without altering the source code for R and compiling your own unique version).
Upvotes: 3