octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54465] Short Circuit Operators not working fo


From: Andrew Lofts
Subject: [Octave-bug-tracker] [bug #54465] Short Circuit Operators not working for ~functions
Date: Wed, 8 Aug 2018 14:19:05 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?54465>

                 Summary: Short Circuit Operators not working for ~functions
                 Project: GNU Octave
            Submitted by: andrewlofts
            Submitted on: Wed 08 Aug 2018 06:19:04 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: AndrewLofts
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Hello, I am working on porting MATLAB to Octave, normally | and & will short
circuit in if() statements just like MATLAB. However if a function with a
negative is used like ~exist(),~strcmp() or ~isempty(), the statements do not
seam to short circuit like MATLABs do. ~= and the functions without ~, however
do work. Example: (Octave/Matlab)


%From an empty workspace
%Octave
if ~exist('a','var') | b == 2
     disp('TRUE');
end
error: 'b' undefined near line 1 column 27

%Matlab
if ~exist('a','var') | b == 2
     disp('TRUE');
end
TRUE


Setting do_braindead_shortcircuit_evaluation doesn't seam to change anything.

Thank you for your help,
Andrew





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54465>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]