Skip to main content
added 72 characters in body
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!

f(char*p){p= - function tacking a program and returning with the eax trick, reusing p.
Calls itself recursively.
Recursion happens before program execution so if all steps are correct a false value is returned and the program is executed.
If there's an error a truthy value is returned and program is not executed at all, an error message is displayed.


f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If there's an error a `truthy` value is returned and `program` is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in `program`program : if `h`h  continue recursion and
   if result is `False`false program do its job.
p is `true`true  if there was an error, `False`false instead.

 - if not `h`h stop recursion and :
*p            - if end of programprogram 
p  is `False`false
&&puts("err") - if not end of programprogram display error
p  is `True`true.



61 58 bytes alternative less interesting solution which runs the program and stops when an error happens

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!

f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If there's an error a `truthy` value is returned and `program` is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in `program` : if `h` continue recursion and
   if result is `False` program do its job.
p is `true` if there was an error, `False` instead.

 - if not `h` stop recursion and :
*p            - if end of program 
p  is `False`
&&puts("err") - if not end of program display error
p  is `True`



61 58 bytes alternative less interesting solution which runs the program and stops when an error happens

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!

f(char*p){p= - function tacking a program and returning with the eax trick, reusing p.
Calls itself recursively.
Recursion happens before program execution so if all steps are correct a false value is returned and the program is executed.
If there's an error a truthy value is returned and program is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in program : if h  continue recursion and
   if result is false program do its job.
p is true  if there was an error, false instead.

 - if not h stop recursion and :
*p            - if end of program 
p  is false
&&puts("err") - if not end of program display error
p  is true.



61 58 bytes alternative less interesting solution which runs the program and stops when an error happens

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !
added 72 characters in body
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!
f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If there's an error a `truthy` value is returned and `program` is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in `program` : if `h` continue recursion and
   if result is `False` program do its job.
`p`p is `true` if there was an error, `False` instead.

 - if not `h` stop recursion and :
*p            - if end of program 
`p`p  is `False`
&&puts("err") - if not end of program display error
`p`p  is `True`



61 58 bytes alternative less interesting solution which runs the program and stops when an error happens

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!
f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If there's an error a `truthy` value is returned and `program` is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in `program` : if `h` continue recursion and
   if result is `False` program do its job.
`p` is `true` if there was an error, `False` instead.

 - if not `h` stop recursion and :
*p            - if end of program 
`p` is `False`
&&puts("err") - if not end of program display error
`p` is `True`



61 58 bytes alternative solution

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!
f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If there's an error a `truthy` value is returned and `program` is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in `program` : if `h` continue recursion and
   if result is `False` program do its job.
p is `true` if there was an error, `False` instead.

 - if not `h` stop recursion and :
*p            - if end of program 
p  is `False`
&&puts("err") - if not end of program display error
p  is `True`



61 58 bytes alternative less interesting solution which runs the program and stops when an error happens

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !
added 583 characters in body
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58

C (gcc), 7171 65 bytes

i;ff(char*p){*p?(i=*pp=*p-'h')?puts*p&&puts("err"):f(p+1),i||puts||!puts("Hello World"):0;;}

Try it online!Try it online!

  • Thanks to @rtpax for saving 6!
*p?f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If :0;there's an -error Itratea program`truthy` recursivelyvalue untilis endreturned :and `program` is not executed at all, an error message is displayed.

(i=*p*p-'h')? `...` :f(p+1)||!puts("Hello World");
 - Setcheck `i`each character in `program` : if current`h` charactercontinue recursion and
   if result is not`False` `h`program do its job.
puts("err")`p` is -`true` if sothere printwas `err`an anderror, stop`False` recursioninstead. 

 - if not `h` stop recursion and :f(p+1),
*p            - elseif callend nextof recursionprogram before
`p` printing..is `False`
i||puts&&puts("Hello World""err") - Butif printnot onlyend ifof `i`program display error
`p` is `0``True`



61 bytes simpler but less interesting.61 58 bytes alternative solution

f(char*p){*p&&puts(*p-'h'?*p&&puts("err"):puts("Hello World")+f>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !

C (gcc), 71 bytes

i;f(char*p){*p?(i=*p-'h')?puts("err"):f(p+1),i||puts("Hello World"):0;}

Try it online!

*p? ... :0;  - Itrate program recursively until end :

(i=*p-'h')?  - Set `i` if current character is not `h`.
puts("err")  - if so print `err` and stop recursion.
:f(p+1),      - else call next recursion before printing..
i||puts("Hello World") - But print only if `i` is `0`

61 bytes simpler but less interesting.

f(char*p){*p-'h'?*p&&puts("err"):puts("Hello World")+f(p+1);}

C (gcc), 71 65 bytes

f(char*p){p=*p-'h'?*p&&puts("err"):f(p+1)||!puts("Hello World");}

Try it online!

  • Thanks to @rtpax for saving 6!
f(char*p){p=  - function tacking a `program` and returning with the eax trick, reusing `p`.
Calls itself recursively.
Recursion happens before `program` execution so if all steps are correct a `false` value is returned and the `program` is executed.
If there's an error a `truthy` value is returned and `program` is not executed at all, an error message is displayed.

*p-'h'? `...` :f(p+1)||!puts("Hello World");
 - check each character in `program` : if `h` continue recursion and
   if result is `False` program do its job.
`p` is `true` if there was an error, `False` instead. 

 - if not `h` stop recursion and :
*p            - if end of program 
`p` is `False`
&&puts("err") - if not end of program display error
`p` is `True`



61 58 bytes alternative solution

f(char*p){*p&&puts(*p-'h'?"err":"Hello World")>4&&f(p+1);}
  • Saved 3 thanks to @rtpax !
Added option
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58
Loading
deleted 12 characters in body
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58
Loading
Source Link
AZTECCO
  • 10.9k
  • 1
  • 15
  • 58
Loading