MATLAB... and MS-DOS and Bash? 7 bytes
P. Length verification
First post here.
I thought this was going to be easy with MATLAB, as you can just enter a single digit number and it will return that as-is. Except that MATLAB prints more than just the number back out...
Same goes for strings.
Now I might've just waved my hands and said good enough, but where's the fun in that? :)
The only methods I knew of, that can print something to console without the extra
ans = would be to use the
9 Bytes. Note,
Disp(0) and other single-digit variations will not work due to average length constraint.
These two are valid submissions, but I kept wondering... Can I do better?
Then I learned I could send commands to the operating system with the Shell Escape Function. i.e.
Except the command is sent to whatever operating system that machine is running on. Since MATLAB is available for both Windows and Unix, whatever command I choose needs to work on both; ensuring that my code runs on all machines.
This more or less locked me to the single command;
echo. (Kinda anti-climactic, really)
A few trials and error with the output character, and I converged to the final answer. 7 Bytes.
>> !echo P
I really hope this isn't breaking any rules here...