f=@(s)s(1)==35&(isvarname(s(2:end))|nnz(s)<2) disp('truthy values:');f('#')f('#e')f('#_ABC')f('#thisisanunexpectedlylongstringxoxoxoxo')f('#USElection2016')disp('falsy values:');f('Hello, World!')f('#12thBday')f('#not-valid')f('#alsoNotValid!')f('NoHash')
Standard input is empty
f = @(s) s (1) == 35 & (isvarname (s (2:end)) | nnz (s) < 2) truthy values: ans = 1 ans = 1 ans = 1 ans = 1 ans = 1 falsy values: ans = 0 ans = 0 ans = 0 ans = 0 ans = 0
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!